gpt4 book ai didi

wix - 如何让 WiX 主要升级工作?

转载 作者:行者123 更新时间:2023-12-03 20:19:41 27 4
gpt4 key购买 nike

我正在努力启用 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."/>

最佳答案

这是我用于所有软件包的片段,经过许多内部和公共(public)版本的改进

<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>

关于wix - 如何让 WiX 主要升级工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2269438/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com