仅在卸载期间而不是重大升级期间运行Wix Custom操作 [英] Run Wix Custom action only during uninstall and not during Major upgrade
问题描述
我正在尝试使用在InstallInitialise
和InstallFinalize
标准动作之间安排的自定义动作来删除文件.
I am trying to delete a file using a custom action scheduled between InstallInitialise
and InstallFinalize
standard action.
MajorUpgrade element
用于设计升级.
但是,我希望自定义操作仅在卸载期间运行,而不在主要升级(包括卸载和安装)期间运行.
However, I want the custom action to run only during uninstall and not during the Major upgrade(this includes uninstall and install).
我使用以下条件来执行CUstom动作:
I have used the following conditions to execute the CUstom action:
-
(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")
-
REMOVE AND NOT WIX_UPGRADE_DETECTED
(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")
REMOVE AND NOT WIX_UPGRADE_DETECTED
有没有一种方法可以使用Wix中的属性唯一地检测主要升级?
Is there a way to uniquely detect the Major Upgrade using properties in Wix?
推荐答案
菲尔已经回答了.我要发表几个小时前写的东西 在出发之前.您指定的条件对我来说看起来不错. 也许我会快速回顾一下可能导致的事情 混乱-例如什么自定义操作何时运行?
Phil has already answered. I'll just post what I wrote a few hours ago before heading out. The conditions you specify look pretty good to me. Maybe I'll do a quick review of things that are likely to cause confusion - such as what custom actions run when?
主要升级 :主要升级实际上是安装新应用程序版本并结合了旧版本的卸载-可能有不同的卸载计划(卸载旧版本和卸载版本).安装新的,或安装新的并卸载旧的).因此,在进行重大升级操作时, 1)
卸载序列仅针对旧设置运行,而 2)
新安装程序仅运行其安装顺序.这对于了解什么时候以及为什么运行自定义操作至关重要.
Major Upgrades: A major upgrade is really an install of a new application version combined with the uninstall of the old version - with different uninstall scheduling possible (uninstall old and install new, or install new and uninstall old). Hence, during a major upgrade operation, 1)
the uninstall sequence runs only for the old setup, and 2)
the new setup runs only its install sequence. This is of crucial importance to understand what custom actions runs when and why.
自定义操作和主要升级 :换句话说:此顺序可能会给自定义操作顺序带来很大的混乱,因为它看起来像是操作实际上是在旧安装程序的卸载顺序中运行的,它是从新安装程序运行的.如果您对序列草率工作比较草率,则通常的错误是在升级过程中看到同一操作多次运行-如果在即时模式下运行自定义操作,则每次设置可能运行两次(总计四次).
Custom Actions and Major Upgrades: To put it in other words: this sequencing can cause quite a bit of confusion for custom action sequencing, since it could appear that an action runs from the new setup, when it in fact runs in the old setup's uninstall sequence. If you are sloppy with sequencing, the typical error is seeing the same action run many times during the upgrade process - potentially twice from each setup (four times in total) - if you run the custom action in immediate mode.
不进行重大升级改造 :如Phil所述,您无法在新设置内添加将在旧设置的卸载序列中运行的自定义操作.该自定义操作必须是原始设置的一部分,或者必须通过较小的升级来添加(该升级将就地升级现有安装,而不是卸载并重新安装它).
No Retrofitting for Major Upgrades: As Phil explains, you can not add a custom action that will run during the old setup's uninstall sequence inside the new setup. That custom action would have had to be part of the original setup, or added via a minor upgrade (which upgrades the existing installation in-place, rather than uninstall and reinstall it).
重要 :
Important:
-
UPGRADINGPRODUCTCODE
仅在主要升级过程中要卸载的设置中设置.在正在安装的新版本中未设置.- 因此条件
UPGRADINGPRODUCTCODE
在安装设置中不是真的,仅在卸载设置中.
UPGRADINGPRODUCTCODE
is set only in a setup that is being uninstalled as part of a major upgrade. It is not set in the new version being installed.- The condition
UPGRADINGPRODUCTCODE
is hence not true in the installing setup, only in the uninstalling setup.
- 因此,条件
WIX_UPGRADE_DETECTED
在安装设置中为 true ,但在卸载设置中为 true .
- The condition
WIX_UPGRADE_DETECTED
is hence true in the installing setup, but not in the uninstalling setup.
WIX_UPGRADE_DETECTED :要进一步详细说明,
WIX_UPGRADE_DETECTED
严格来说不是自定义WiX功能-它是WiX标准或设置内置MSI属性的约定ActionProperty
进行升级.所有支持重大升级的MSI文件都具有这样的属性,WiX只是以一种标准的方式对其进行命名.该属性设置在升级表,并且它是安装程序在安装过程中在同一盒子上找到相关产品(即较低版本(因此将要卸载)的相关产品)时设置的属性.WIX_UPGRADE_DETECTED: To go into even more detail,
WIX_UPGRADE_DETECTED
is strictly speaking not a custom WiX feature - it is a WiX standard or convention for setting the built-in MSI propertyActionProperty
for the upgrade process. All MSI files supporting major upgrades have such a property, WiX just names it in a standard way. The property is set in a column in the Upgrade table, and it is a property that is set when a setup finds related products - that are lower versions (and hence to be uninstalled) - on the same box during installation.WIX_DOWNGRADE_DETECTED :请注意,在使用MajorUpgrade元素的标准WiX编译的MSI中,还存在
WIX_DOWNGRADE_DETECTED
-该属性用于列出发现的更高级别的产品版本而不是正在运行的安装程序.这些将阻止有问题的安装程序的安装-在大多数情况下(除非设置是由安装程序设计者自定义的).WIX_DOWNGRADE_DETECTED: Note that in a standard WiX-compiled MSI using the MajorUpgrade element there is also
WIX_DOWNGRADE_DETECTED
- the property used to list products found that are of higher version than the running setup. These would block the setup in question from installing - in most cases (unless the settings are customized by the setup designer).在升级表中指定的操作属性可以是任何",但
WIX_UPGRADE_DETECTED
和WIX_DOWNGRADE_DETECTED
.检查已编译的MSI的升级表这是如何详细工作的.这是一个屏幕截图:The action property specified in the upgrade table can be "anything", but the MajorUpgrade Element "convenience feature" does this for you in an "auto-magical" way that makes sense for most purposes - using the mentioned property names
WIX_UPGRADE_DETECTED
andWIX_DOWNGRADE_DETECTED
. Check the Upgrade Table of your compiled MSI to see how this works in detail. Here is a screen shot:我写了这个其他答案,显示了如何将另一个属性名称(
YOURUPGRADEPROPERTY
)用作"ActionProperty
":I wrote this other answer showing how to use another property name (
YOURUPGRADEPROPERTY
) as "ActionProperty
": wix installer update process and confirmation dialog (the linked answer is not a recommendation, demonstration only). Just a link, probably not very useful for you now that I think about it.某些链接 :
Some Links:
这篇关于仅在卸载期间而不是重大升级期间运行Wix Custom操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- The condition
- 因此条件