如何让 WiX 删除 windows 服务?
How do I get WiX to remove a windows service?
我正在尝试让 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>
我在这里遗漏了什么吗?
事实证明,服务没有删除的原因是因为我打开了服务 MMC。关闭并重新打开后,服务删除成功。
我正在尝试让 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>
我在这里遗漏了什么吗?
事实证明,服务没有删除的原因是因为我打开了服务 MMC。关闭并重新打开后,服务删除成功。