【问题标题】:'wix execute batch before uninstall with administrator'wix 在管理员卸载前执行批处理
【发布时间】:2012-09-19 05:16:54
【问题描述】:

我的 WiX XML 文件安装的应用程序包含名为 OLOLO_SERVICE 的 Windows 服务(例如)。我想在安装/重新安装我的应用程序时停止此服务。

我将 CustomAction 与 ExeCommand='sc stop OLOLO_SERVICE' 一起使用。

<CustomAction Id='EnsureThatServiceIsStopped' Directory='INSTALLLOCATION' 
Impersonate="no" Execute="immediate" ExeCommand="sc 
stop OLOLO_SERVICE" Return="ignore" />

标签里面是action

<Custom Action='EnsureThatServiceIsStopped' Before='InstallValidate' />

但这不起作用,卸载程序显示此窗口“要继续卸载,您应该停止关注可执行文件”(可能不是 100% 正确,因为在我的俄语 Windows 7 中它是用俄语编写的)。

我认为可能的原因是

  • 脚本在获得管理员权限之前运行(并且停止服务失败,因为它需要管理员权限)
  • 脚本在验证后运行(检查已安装的可执行文件时验证失败)

请帮帮我,我想使用批处理 'sc stop OLOLO_SERVICE' 停止服务

附言。我决定简化一个问题:我希望我的 WiX 在检查正在运行的应用程序之前以管理员权限执行“sc stop OLOLO_SERVICE”

【问题讨论】:

    标签: wix uninstallation custom-action servicecontroller


    【解决方案1】:

    您不需要在批处理文件中执行此操作,可以使用ServiceControl 元素:

    <ServiceControl Id="ServiceControl_OloService" 
                    Name="OLOLO_SERVICE"
                    Stop="both"
                    Remove="uninstall"
                    Wait="yes" />
    

    【讨论】:

      猜你喜欢
      • 2019-06-14
      • 1970-01-01
      • 2022-10-18
      • 2015-04-17
      • 2016-12-29
      • 2017-11-10
      • 1970-01-01
      • 2014-07-26
      • 1970-01-01
      相关资源
      最近更新 更多