【问题标题】:How do I get WiX to remove a windows service?如何让 WiX 删除 Windows 服务?
【发布时间】:2017-01-09 19:25:36
【问题描述】:

我正在尝试让 Wix 在卸载时删除 Windows 服务。它在安装过程中添加了该服务,但在卸载过程中,它并没有删除该服务,而是将其禁用。此外,我无法使用命令行 sc 工具将其删除,因为它说指定的服务不作为已安装的服务存在。如果我再次尝试运行安装程序,它会告诉我我没有足够的权限来安装系统服务。我可以摆脱它的唯一方法是从注册表中删除它并重新启动机器。必须有更好的方法来做到这一点。这是我的 wxs 文件中的组件块:

<Component Id="MyService.exe" Guid="5187d4cf-c7b7-4f9e-9f2c-2d0557ecdf5e">
    <File Id="MyService.exe" Name="MyService.exe" DiskId="1" Source="$(var.MyService.TargetDir)\MyService.exe" KeyPath="yes" />
    <ServiceInstall Id="MyService.exe" Type="ownProcess" Name="MyService.exe" DisplayName="MyService" Description="MyService"
                    Start="auto" Account="LocalSystem" ErrorControl="normal" Vital="yes" />
    <ServiceControl Id="MyService.exe" Stop="both" Remove="uninstall" Name="MyService.exe" Wait="yes" />
  </Component>

这里有什么我遗漏的吗?

【问题讨论】:

    标签: wix windows-services


    【解决方案1】:

    事实证明,服务没有被删除的原因是我打开了服务 MMC。一旦我关闭它并重新打开它,服务就成功删除了。

    【讨论】:

    • 好旧的“标记为删除”,但在您关闭此窗口问题之前不会真正被删除。
    • @BrianSutherland 在 2020 年底仍然很重要
    猜你喜欢
    • 2018-05-14
    • 1970-01-01
    • 2010-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多