我被要求将版本 1.0.0.0 升级到 1.0.0.1。默认情况下,当我使用虚拟安装程序进行测试时,如果我们更改产品代码,1.0.0.0 和 1.0.0.1 将并排安装。
但是如果我们做ver 1.0.1.0(同时更改产品代码),它会进行升级。这是我的升级部分:
<Upgrade Id="{354E9DAE-EB70-4BCC-BD93-AC20ACE3F370}">
<UpgradeVersion
Maximum="$(var.ver)"
Property="DOMAJORUPGRADE"
MigrateFeatures="yes"
IncludeMinimum="yes"/>
</Upgrade>
问题:有什么方法可以将 1.0.0.0 升级到 1.0.0.1?
实际上,我得到了这样的场景:
最佳答案
查看帮助主题 MajorUpgrade Element :
以下是关于 AllowSameVersionUpgrades 属性的说明:
When set to no (the default), installing a product with the same version and upgrade code (but different product code) is allowed and treated by MSI as two products. When set to yes, WiX sets the msidbUpgradeAttributesVersionMaxInclusive attribute, which tells MSI to treat a product with the same version as a major upgrade.
This is useful when two product versions differ only in the fourth version field. MSI specifically ignores that field when comparing product versions, so two products that differ only in the fourth version field are the same product and need this attribute set to yes to be detected.
Note that because MSI ignores the fourth product version field, setting this attribute to yes also allows downgrades when the first three product version fields are identical. For example, product version 1.0.0.1 will "upgrade" 1.0.0.2998 because they're seen as the same version (1.0.0). That could reintroduce serious bugs so the safest choice is to change the first three version fields and omit this attribute to get the default of no.
This attribute cannot be "yes" when AllowDowngrades is also "yes" -- AllowDowngrades already allows two products with the same version number to upgrade each other.
蒂姆的答案是 95% 正确。我真的不建议只更改第 4 个版本。也就是说,有一种方法可以减轻上面提到的“意外降级”错误。编写未检测到相同版本的 MajorUpgrade 规则。然后编写一个自定义操作,对第四个字段中更大的产品进行额外检查并共享您的升级代码。将此检测到的 ProductCode 设置或附加到 ActionProperty。在 FindRelatedProducts 和 RemoveExistingProducts 之间安排此自定义操作,您将获得 Windows Installer 从未设计过的所需行为。
关于wix - 我们可以在更改产品代码的同时将 1.0.0.0 升级到 1.0.0.1 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16642518/