【发布时间】:2021-01-19 08:20:37
【问题描述】:
我们有一些使用 WIX 作为安装程序技术的产品。安装程序中的升级处理由 MajorUpgrade 元素处理
<Wix>
<Product Id="..." Name="..." Language="..."
Version="..." Manufacturer="..."
UpgradeCode="...">
...
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" AllowSameVersionUpgrades="yes" />
</Product>
</Wix>
如您所见,到目前为止,我们都支持从所有旧版本进行升级,但是我们必须对此进行一些更改,以便只能升级某个版本以上的版本,而旧版本会收到错误消息并升级失败.
根据我的研究,这应该可以使用 Upgrade 元素(如https://www.firegiant.com/wix/tutorial/upgrades-and-modularization/checking-for-oldies/ 中所述)
我现在的问题:
- 是否可以/建议混合使用 MajorUpgrade 和 Upgrade 元素?
- 有没有更好的方法来实现这一点?
更新
感谢您的回复和回答,我使用的解决方案如下:
<Wix>
<Product Id="..." Name="..." Language="..."
Version="..." Manufacturer="..."
UpgradeCode="My_upgrade_code">
...
<InstallExecuteSequence>
...
<Custom Action='UpdateFromVersionNotSupported' After='FindRelatedProducts'>UNSUPPORTEDUPDATEVERSIONFOUND</Custom>
...
</InstallExecuteSequence>
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" AllowSameVersionUpgrades="yes" />
<Upgrade Id='My_upgrade_code'>
<UpgradeVersion OnlyDetect='yes' Property='UNSUPPORTEDUPDATEVERSIONFOUND' Maximum='Oldes_version_where_update_is_allowed' IncludeMaximum='no' />
</Upgrade>
<CustomAction Id='UpdateFromVersionNotSupported' Error='Updates are only supported from version ?? or later' />
</Product>
</Wix>
【问题讨论】:
-
为什么要安装ExecuteSequence?我认为应该是InstallUISequence?
标签: wix