将 InstallScope 更改为“perMachine"后如何修复 wix 设置的升级逻辑? [英] How do I fix the upgrade logic of a wix setup after changing InstallScope to "perMachine"

查看:21
本文介绍了将 InstallScope 更改为“perMachine"后如何修复 wix 设置的升级逻辑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用 wix 为我们的应用程序创建设置.对于用户已经安装了旧版本应用程序的情况,我们使用 主要升级 XML 元素.这一切都按预期工作:如果安装了旧版本,它会透明地升级.如果存在更新的版本,安装程序将中止并显示一条明确的消息.

We use wix to create setups for our application. For the case where the user has already installed an older version of our application, we do a major upgrade with the MajorUpgrade XML element. This is all working as desired: if an older version is installed, it is upgraded transparently. If a newer version is present, the installer aborts with a clear message.

但是,我现在想更改 InstallScope 从perUser"到perMachine".不幸的是,这打破了升级逻辑.新安装程序似乎不会检测和删除以前的perUser"安装.相反,它只是将自己安装在同一 ProgramFiles 位置的旧版本之上.用户可以在添加/删除程序"列表中看到两个条目,并在桌面上看到两个相同的快捷方式(旧的特定于用户的快捷方式和新的 perMachine 快捷方式).

However, I now want to change the InstallScope from "perUser" to "perMachine". Unfortunately this breaks the upgrade logic. The new installer does not appear to detect and remove the previous "perUser" installation. Instead, it just installs itself on top of the older version in the same ProgramFiles location. The user gets to see two entries in the "add/remove programs" list and sees two identical shortcuts on the desktop (the old user-specific one and the new perMachine one).

如何在不破坏升级逻辑的情况下将我的安装程序从perUser"转换为perMachine"安装范围?

How do I transition my installer from the "perUser" to the "perMachine" install scope without breaking the upgrade logic?

推荐答案

从每台机器配置开始.

<Property Id="ALLUSERS" Value="1" />

这将运行自动每台机器检查(如果您有 MajorUpgrade 元素工作,我认为),不会选择以前的每用户安装:

This will run an automatic per-machine check (if you have the MajorUpgrade element working, I presume), that does not pick up the previous per-user install:

Action start 15:46:35: FindRelatedProducts.
MSI (c) (D0:0C) [15:46:35:496]: FindRelatedProducts: current install is per-machine.  Related install for product '{0C6604FB-58EC-48B9-8259-5871EFDADEB9}' is per-user.  Skipping...
MSI (c) (D0:0C) [15:46:35:496]: FindRelatedProducts: current install is per-machine.  Related install for product '{0C6604FB-58EC-48B9-8259-5871EFDADEB9}' is per-user.  Skipping...

因此,在安装之前,请确保为已安装在用户范围内的产品运行另一个 FindRelatedProducts 调用(例如,像这样):

So before install, make sure you run another FindRelatedProducts call for products that have been installed in user scope (e.g. like this):

<!-- temporarily switch to per-user install scope-->   
<Publish Dialog="MyWelcomeDlg" Control="Next" Property="ALLUSERS" Value="{}">1</Publish>
<!-- find related products that have been installed per-user -->
<Publish Dialog="MyWelcomeDlg" Control="Next" Event="DoAction" Value="FindRelatedProducts">1</Publish>
<!-- switch back to per-machine install scope-->
<Publish Dialog="MyWelcomeDlg" Control="Next" Property="ALLUSERS" Value="1">1</Publish>

这反过来会找到每个用户的安装:

This in turn finds the per-user install:

Action start 15:46:36: FindRelatedProducts.
FindRelatedProducts: Found application: {0C6604FB-58EC-48B9-8259-5871EFDADEB9}
MSI (c) (D0:88) [15:46:36:716]: PROPERTY CHANGE: Adding WIX_UPGRADE_DETECTED property. Its value is '{0C6604FB-58EC-48B9-8259-5871EFDADEB9}'.
MSI (c) (D0:88) [15:46:36:716]: PROPERTY CHANGE: Adding MIGRATE property. Its value is '{0C6604FB-58EC-48B9-8259-5871EFDADEB9}'.

无论在哪个检查中找到现有产品,都将被删除.

Existing products will be removed no matter in which check they are found.

Action start 15:46:41: RemoveExistingProducts.
RemoveExistingProducts: Application: {0C6604FB-58EC-48B9-8259-5871EFDADEB9}

附注:这并不能避免当您有双重用途的安装程序时出现的基本困难:机器上的 User1 可能会在每个用户范围内安装,然后 User2 会在每个用户范围内安装机器.User1 将在他的程序/功能表中看到两个安装,我不知道哪个优先.因此,请考虑仅使用每台机器安装.

On a side note: This does not circumvent a basic difficulty that arises when you have dual-purpose installers: User1 on the machine might install in per-user scope, then later User2 installs per-machine. User1 will see both installs in his programs/features table, and I do not know which one takes precedence. So consider going with per-machine installs only.

这篇关于将 InstallScope 更改为“perMachine"后如何修复 wix 设置的升级逻辑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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