【发布时间】:2014-11-17 15:01:02
【问题描述】:
我在卸载期间遇到了我想运行的自定义操作的问题。 自定义操作负责注销系统级 Windows 服务。
自定义操作:
<CustomAction Id='UnregisterService'
Directory='INSTALLDIR'
ExeCommand='[INSTALLUTIL] /u "/config=[INSTALLDIR]\configInstall.xml" " ...
Return='ignore'
Execute='deferred' />
此操作安排在 InstallExecuteSequence 中,应在卸载和升级时调用:
<InstallExecuteSequence>
<Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
<RemoveExistingProducts After="InstallValidate" />
<Custom Action='UnregisterService' After='InstallFiles'>UPGRADEFOUND OR (Installed AND NOT UPGRADINGPRODUCTCODE)</Custom>
<Custom Action='RemAgApps' After='UnregisterService'>UPGRADEFOUND OR (Installed AND NOT UPGRADINGPRODUCTCODE)</Custom>
...
</InstallExecuteSequence>
问题是当我从 ARP 运行卸载时,未调用 uregister 操作(如 msi 日志中所写):
Skipping action: UnregisterService (condition is false)
当我深入挖掘日志时(这很糟糕......)我看到没有“卸载”操作,只有安装:
Property(C): EXECUTEACTION = INSTALL
Property(C): ACTION = INSTALL
Product: BLABLA -- Installation completed successfully.MSI (c) (BC:50) [14:35:37:067]: Windows Installer installed the product. Product Name: BLABLA . Product Version: 5.1.0. Product Language: 1033. Manufacturer: BLABLA Team. Installation success or error status: 0.
我的问题是:
- msi 卸载流程是怎样的? (没有在网上找不到...)
- 为什么我在卸载过程中收到“安装”操作?
- 如何强制卸载以运行我的“unregisterService”自定义操作?
谢谢!
【问题讨论】:
-
不应该是
Installed AND NOT UPGRADINGPRODUCTCODE(里面有AND)吗? -
是的,谢谢,已修复。
-
REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE 将是卸载的条件,但如果升级则不是。正如 Chris 所说,无论如何你都不应该这样做——安装/卸载/启动/停止/删除服务有很多标准支持。
标签: wix windows-installer wix3.5 wix3.6