wix - 我们可以在更改产品代码的同时将 1.0.0.0 升级到 1.0.0.1 吗?

标签 wix windows-installer upgrade wix3.7

我被要求将版本 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?

实际上,我得到了这样的场景:
  • 在 1.0.0.0 之上安装 1.0.0.1 时,则需要升级 1.0.0.0。
  • 在 1.0.0.1 之上安装 1.0.0.0 时,1.0.0.0 需要失败。
  • 在具有不同产品代码的 1.0.0.1 之上安装 1.0.0.1 时(仅在开发版本中可能),需要卸载现有的 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/

    相关文章:

    WiX/刻录 : Set Uninstall screen information

    wix - 2 个 'identical' msi 文件的大小为何不同?

    c# - 在静默模式下安装 SQL Server Express 2008 以及 C# 应用程序

    vb.net - VB 组合框.NewIndex

    python - 在 Anaconda 上升级到 scikit-learn 的开发版本?

    wix - 如何在两个 WiX 项目中共享一个 WiX 片段?

    wix - 如何使用 Wix 工具集检查 ini 文件是否存在

    wix - 我的 WiX 卸载如何恢复注册表值更改?

    mysql - 高级安装程序 - 如何在安装过程中创建 MySQL 用户?

    c# - WinForms SQLite 数据库升级技巧