【问题标题】:Understanding MSI uninstall - EXECUTEACTION = INSTALL了解 MSI 卸载 - EXECUTEACTION = INSTALL
【发布时间】:2014-11-17 15:01:02
【问题描述】:

我在卸载期间遇到了我想运行的自定义操作的问题。 自定义操作负责注销系统级 Windows 服务。

自定义操作:

     <CustomAction Id='UnregisterService'
    Directory='INSTALLDIR'
    ExeCommand='[INSTALLUTIL] /u &quot;/config=[INSTALLDIR]\configInstall.xml&quot;  &quot; ...
    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.

我的问题是:

  1. msi 卸载流程是怎样的? (没有在网上找不到...)
  2. 为什么我在卸载过程中收到“安装”操作?
  3. 如何强制卸载以运行我的“unregisterService”自定义操作?

谢谢!

【问题讨论】:

  • 不应该是Installed AND NOT UPGRADINGPRODUCTCODE(里面有AND)吗?
  • 是的,谢谢,已修复。
  • REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE 将是卸载的条件,但如果升级则不是。正如 Chris 所说,无论如何你都不应该这样做——安装/卸载/启动/停止/删除服务有很多标准支持。

标签: wix windows-installer wix3.5 wix3.6


【解决方案1】:

在您完全了解 Windows Installer 之前,应避免自定义操作,以避免使用更脆弱的解决方案重新发明轮子。要在卸载期间删除服务,您只需要:

<ServiceControl Id="myService" Name="MyService" Stop="both" Remove="uninstall"/>

阅读这篇好文章:InstallSite: Installation Phases and In-Script Execution

Windows 安装程序安装事务可以采用多种形式。初始安装、修复、维护安装、卸载、升级、补丁等。安装程序跟踪不同级别的功能、组件和产品的状态变化,因此安装/卸载的概念更加详细。

【讨论】:

  • 我需要将参数传递给服务:[INSTALLUTIL] /u "/config=[INSTALLDIR]\configInstall.xml" ” ...如何使用 ServiceControl 做到这一点?
  • ServiceControl 替换了该调用。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-09-23
  • 1970-01-01
  • 1970-01-01
  • 2011-04-04
  • 2014-02-20
  • 1970-01-01
  • 2016-03-07
相关资源
最近更新 更多