如何让WiX主要升级工作?

前端之家收集整理的这篇文章主要介绍了如何让WiX主要升级工作?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在努力启用WiX的主要升级功能.

我希望安装程序的每个新版本都是一个主要的升级(完全卸载,然后是新安装),因为我们不希望不同的升级和干净的安装版本.

我开始尝试使用标签的东西,但我一直在“安装另一个版本”.运行安装程序时出现错误信息.

所以我实现了V3.5中添加的新标签,使升级更容易.我仍然收到错误消息.

然后,我读到某个地方,您需要更改每个新版本的ID GUID.所以我设置Id =“*”让WiX生成它们.

现在,当我安装较新的版本,它不会卸载旧版本,最后两个安装到同一个文件夹.我这样做是因为运行MSI(新的或旧的)会启动修复/删除屏幕.

此外,该程序未被新版本覆盖.

这是WiX脚本的开始:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

    <Product Id="*"
             Name="Foo"
             Language="1033"
             Codepage="1252"
             Version="!(bind.FileVersion.Foo.exe)"
             Manufacturer="Foo Bar Ltd."
             UpgradeCode="dac2fab2-7d76-4e47-b25f-0748380dab81">

        <Package
                 Description="Foo"
                 Comments="This installer database contains the logic and data required to install Foo."
                 InstallerVersion="300"
                 Languages="1033"
                 SummaryCodepage="1252"
                 Platform="x86"
                 Compressed="yes" />

        <!-- Remove older versions -->
        <!-- Important note: MSI ignores the last version digit 1.0.0.? when comparing versions,so always change at least the 3rd digit for new external releases-->
        <MajorUpgrade DowngradeErrorMessage="The version currently installed is newer than the version you are attempting to install."/>
这是一个我所用的所有软件包的代码片段,在许多内部和公开发行版本上进行了改进
<Product Id="*"
         UpgradeCode="$(var.Property_UpgradeCode)"
         Name="!(loc.ApplicationName)"
         Language="!(loc.Property_ProductLanguage)"
         Version="$(var.version)"
         Manufacturer="!(loc.ManufacturerName)" >

    <Package Description="!(loc.Package_Description) $(var.version)"
           Comments="!(loc.Package_Comments)"
           Manufacturer="!(loc.ManufacturerName)"
           InstallerVersion="301"
           Compressed="yes"
           InstallPrivileges="elevated"
           InstallScope="perMachine"
           Platform="$(var.ProcessorArchitecture)" />

    <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />

    <Upgrade Id="$(var.Property_UpgradeCode)">
        <UpgradeVersion OnlyDetect="yes"
                        Minimum="$(var.version)"
                        Property="NEWERVERSIONDETECTED"
                        IncludeMinimum="no" />

        <UpgradeVersion OnlyDetect="no"
                        Maximum="$(var.version)"
                        Property="OLDERVERSIONBEINGUPGRADED"
                        IncludeMaximum="no" />

        <!-- Detect for changes in 4th field only -->
        <UpgradeVersion Property="ANOTHERBUILDINSTALLED"
                 Maximum="$(var.version)" Minimum="$(var.version)"
                 IncludeMinimum="yes" IncludeMaximum="yes" OnlyDetect="yes" />

    </Upgrade>

    <CustomAction Id="CA_BlockOlderVersionInstall" Error="!(loc.LaunchCondition_LaterVersion)" />
    <CustomAction Id="CA_BlockAnotherBuildInstall" Error="!(loc.LaunchCondition_AnotherBuild)" />

    <InstallExecuteSequence>
        <Custom Action="CA_BlockOlderVersionInstall" After="FindRelatedProducts">
            <![CDATA[NEWERVERSIONDETECTED]]>
        </Custom>

        <!-- Prevent installation on 4th version field change only -->
        <Custom Action="CA_BlockAnotherBuildInstall" After="FindRelatedProducts">
            <![CDATA[ANOTHERBUILDINSTALLED]]>
        </Custom>

        <LaunchConditions After="AppSearch" />

        <!-- Schedule RemoveExistingProducts early -->
        <RemoveExistingProducts After="InstallInitialize" />
    </InstallExecuteSequence>

    <InstallUISequence>
        <Custom Action="CA_BlockOlderVersionInstall" After="FindRelatedProducts">
            <![CDATA[NEWERVERSIONDETECTED]]>
        </Custom>

        <!-- Prevent installation on 4th version field change only -->
        <Custom Action="CA_BlockAnotherBuildInstall" After="FindRelatedProducts">
            <![CDATA[ANOTHERBUILDINSTALLED]]>
        </Custom>

        <LaunchConditions After="AppSearch" />
    </InstallUISequence>

    <!-- .... -->

</Product>
原文链接:https://www.f2er.com/windows/371510.html

猜你在找的Windows相关文章