Wix 主要升级问题 [英] Wix MajorUpgrade problems

查看:37
本文介绍了Wix 主要升级问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是场景.

1.) 安装 1.0.1.1 然后升级到 1.0.2.2 ===> 这很有效(如预期)

2.) 安装 1.0.2.2 然后降级到 1.0.1.1 ===> 这不起作用(如预期)

3.) 安装 1.0.1.1 然后安装 1.0.1.1 ===> 这将进入修复/删除模式(如预期)

4.) 安装 1.0.1.1 然后安装 1.0.1.2 ===> 它像新安装一样安装,并在控制面板的添加/删除程序中显示该程序两次(我想它应该像 3 一样工作.)因为,据我了解,MSI 并不关心产品版本的第 4 部分)

我做错了什么吗?

<Product Id="*" Name="My product" Version="$(var.Version)" Language="1033" Manufacturer="My Company" UpgradeCode="MY-UPGRADE-CODE"><Package Description="My product" Comments="Comments" InstallerVersion="200" Compressed="yes"/>" <MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="已经安装了更高版本的 [ProductName].安装程序现在将退出./>

解决方案

这是 WIX 文档中提到的行为.您需要在 MajorUpgrade 元素中将以下属性设置为是"来处理这种情况.阅读突出显示的文本以了解更多详情.

AllowSameVersionUpgrades (YesNoType)

设置为 no(默认)时,允许安装具有相同版本和升级代码(但产品代码不同)的产品,MSI 将其视为两个产品.设置为 yes 时,WiX 设置 msidbUpgradeAttributesVersionMaxInclusive 属性,该属性告诉 MSI 将具有相同版本的产品视为主要升级.

当两个产品版本仅在第四个版本字段中不同时,这很有用.MSI 在比较产品版本时会特别忽略该字段,因此仅在第四个版本字段中不同的两个产品是同一产品,需要将此属性设置为 yes 才能检测到.

请注意,由于 MSI 会忽略第四个产品版本字段,因此当前三个产品版本字段相同时,将此属性设置为 yes 也允许降级.例如,产品版本 1.0.0.1 将升级"1.0.0.2998,因为它们被视为相同的版本 (1.0.0).这可能会重新引入严重的错误,因此最安全的选择是更改前三个版本字段并省略此属性以获得默认值 no.

当 AllowDowngrades 也为yes"时,此属性不能为yes"——AllowDowngrades 已经允许具有相同版本号的两个产品相互升级.

来源:WIX 文档

Here're the scenarios.

1.) Install 1.0.1.1 then upgrade to 1.0.2.2 ===> This works well (as expected)

2.) Install 1.0.2.2 then downgrade to 1.0.1.1 ===> This doesn't work (as expected)

3.) Install 1.0.1.1 then install 1.0.1.1 ===> This goes into Repair/Remove mode (as expected)

4.) Install 1.0.1.1 then install 1.0.1.2 ===> It is installed like a new one and show the program twice in Add/Remove program in control panel (I suppose it should work like 3.) because, from my understanding, MSI doesn't care the 4th part of product version)

Am I doing anything wrong ?

<Product Id="*" Name="My product" Version="$(var.Version)" Language="1033"  Manufacturer="My Company" UpgradeCode="MY-UPGRADE-CODE">

<Package Description="My product" Comments="Comments" InstallerVersion="200" Compressed="yes" />

<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." />

解决方案

This is behaving as mentioned in the WIX documentation. You need to set the below property to "Yes" in the MajorUpgrade element to handle this scenario. Read the highlighted text for more details.

AllowSameVersionUpgrades (YesNoType)

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.

Source: WIX Documentation

这篇关于Wix 主要升级问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆