WIX:升级时,有2个不同的UpgradeCodes怎么办? [英] WIX: When upgrading, what to do when there are 2 different UpgradeCodes?

查看:14
本文介绍了WIX:升级时,有2个不同的UpgradeCodes怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里得到一个好的答案后:WIX:如何卸载以前使用 VS *.vdproj 构建的 MSI,现在我在现场面临不同的问题.

After getting a good answer here: WIX: How can I uninstall a previous MSI built using a VS *.vdproj, now i'm facing a different issue in the field.

我有 2 个版本,有 2 个不同的升级代码.发生这种情况是因为我们已经部署了新 WIX 的一个版本,而无需将 UpgradeCode 与旧 MSI 同步.

I have 2 versions out there, with 2 different UpgradeCodes. That happened because we already deployed one version of the new WIX w/out syncing the UpgradeCode with the old MSI.

将新的 Wix 安装程序与其中一个代码同步,升级会顺利进行.我对第二个感到厌烦吗?我试图从添加/删除"中卸载额外的一个,并且运行顺利,但在我指示这些用户转到添加/删除"之前,我想知道是否有另一种技巧可以同时处理这两种情况.

Syncing the new Wix installer with one of the codes, upgrade goes smoothly. Am I hosed on the second one? I tried to just uninstall the extra one from Add/Remove and that worked smoothly, but before I instruct those users to go to Add/Remove, I wanted to know if there's another trick to handle both.

也许如果我可以在安装过程中以某种方式检测安装了哪个版本,我可以动态设置新的 Wix UpgradeCode 吗?

Maybe if I can somehow detect during installation which version is installed, can i set the new Wix UpgradeCode dynamically?

推荐答案

将两个 UpgradeCode 放入 Upgrade 表中,分成两个单独的行.这允许您在升级期间让 MSI 自动卸载旧的 MSI(如果这是您想要的),并为您提供 MSI 属性以有条件地使用以检查系统上已安装的内容.

Put both UpgradeCodes into the Upgrade table into two separate rows. This allows you to have the MSI automatically uninstall the older MSIs during an upgrade (if that's what you want), as well as give you MSI properties to use conditionally to check what's already installed on the system.

更新(回复第一条评论)

Update (to respond to the first comment)

  <!-- old product -->
  <Upgrade Id="$(var.UpgradeCode1)">
     <UpgradeVersion Property="OLD_PRODUCT_FOUND_1"
                     IncludeMaximum="yes"
                     Maximum="2.0.0"
                     MigrateFeatures="yes"
                     OnlyDetect="no" />
  </Upgrade>

  <!-- new product -->
  <Upgrade Id="$(var.UpgradeCode2)">
     <UpgradeVersion Property="OLD_PRODUCT_FOUND_2"
                     IncludeMaximum="yes"
                     Maximum="3.0.0"
                     MigrateFeatures="yes"
                     OnlyDetect="no" />
  </Upgrade>

此代码将检测两个 UpgradeCodes,如果找到一个(或两个),将在 RemoveExistingProducts 操作期间将其删除.

This code will detect both UpgradeCodes, and if one (or both) are found will remove them during the RemoveExistingProducts action.

这篇关于WIX:升级时,有2个不同的UpgradeCodes怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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