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

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

问题描述

我们使用wix为我们的应用程序创建设置.对于用户已经安装了较旧版本的应用程序的情况,我们使用 MajorUpgrade 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.

但是,我现在想更改

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?

推荐答案

从每台计算机的配置开始.

Starting out with per-machine configuration.

<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将在他的program/features表中看到这两个安装,并且我不知道哪个优先.因此,请考虑仅按机器安装.

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天全站免登陆