我想在卸载期间运行自定义操作时出现问题。 自定义操作负责取消注册系统级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)
当我深入挖掘日志时(这很糟糕......)我发现没有“卸载”#39;动作,只安装:
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.
我的问题是:
谢谢!
答案 0 :(得分:1)
应该避免自定义操作,直到您完全了解Windows Installer,以避免使用更脆弱的解决方案重新发明轮子。要在卸载期间删除服务,您只需要:
<ServiceControl Id="myService" Name="MyService" Stop="both" Remove="uninstall"/>
阅读这篇好文章:InstallSite: Installation Phases and In-Script Execution
Windows安装程序安装事务可以采用多种形式。初始安装,维修,维护安装,卸载,升级,补丁等。安装程序会跟踪不同级别的功能,组件和产品的状态更改,因此安装/卸载的概念更加详细。