我们可以在更改产品代码的同时将 1.0.0.0 升级到 1.0.0.1 吗? [英] Can we upgrade 1.0.0.0 to 1.0.0.1 while changing product code?

查看:26
本文介绍了我们可以在更改产品代码的同时将 1.0.0.0 升级到 1.0.0.1 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被要求将 1.0.0.0 版升级到 1.0.0.1.默认情况下,当我使用虚拟安装程序进行测试时,如果我们更改产品代码,1.0.0.0 和 1.0.0.1 将并排安装.

I'm asked to upgrade ver 1.0.0.0 to 1.0.0.1. By default, when I tested with a dummy installer, if we change the product code, both 1.0.0.0 and 1.0.0.1 would install side by side.

但是如果我们做 ver 1.0.1.0(同时更改产品代码),它会进行升级.这是我的升级部分:

But if we do the ver 1.0.1.0 (while changing product code), it would do the upgrade. Here is my upgrade segment:

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

Question: Is there any method to upgrade 1.0.0.0 to 1.0.0.1?

实际上,我看到了这样一个场景:

Actually, I'm given a scenario like this:

  1. 在 1.0.0.0 之上安装 1.0.0.1 时,需要升级 1.0.0.0.
  2. 在 1.0.0.1 之上安装 1.0.0.0 时,1.0.0.0 需要失败.
  3. 在具有不同产品代码的 1.0.0.1 之上安装 1.0.0.1 时(仅适用于开发版本),需要卸载现有的 1.0.0.1.

推荐答案

查看帮助主题 主要升级元素:

以下是关于 AllowSameVersionUpgrades 属性的说明:

The following is said about the AllowSameVersionUpgrades attribute:

当设置为 no(默认)时,安装具有相同版本和升级代码(但不同的产品代码)是允许的,并且MSI 将其视为两种产品.当设置为 yes 时,WiX 设置msidbUpgradeAttributesVersionMaxInclusive 属性,它告诉 MSI将版本相同的产品视为重大升级.

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.

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

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.

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

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.

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

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 从未设计过的所需行为.

Tim's answer is 95% correct. I really don't suggest changing only the 4th version. That said, there is a way to mitigate the "accidental downgrade" bug mentioned above. Write a MajorUpgrade rule that does not detect the same version. Then write a custom action that does an additional check for products that are greater in the fourth field and share your UpgradeCode. Set or append this detected ProductCode to the ActionProperty. Schedule this custom action betweeen FindRelatedProducts and RemoveExistingProducts and you'll get the desired behavior that Windows Installer was never designed for.

这篇关于我们可以在更改产品代码的同时将 1.0.0.0 升级到 1.0.0.1 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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