【发布时间】:2012-01-27 16:55:05
【问题描述】:
我是 WiX 的新手,但过去我使用 Installshield 和 Windows Installer 做过一些事情。
我有一个我认为相当简单的安装程序,它可以设置 Windows 服务。如果有什么不同,它会将其设置在“NT AUTHORITY\NETWORK SERVICE”下。
安装工作正常,但在卸载过程中我收到提示告诉我“安装程序必须更新系统运行时无法更新的文件或服务。如果您选择继续,则需要重新启动才能完成安装程序."。如果我单击“确定”,则除服务外的所有内容都将被卸载(即使在重新启动后)。它仍然处于启动状态,并且与该服务关联的 exe 也被留下。
我可以使用 sc.exe 命令手动停止和删除服务,而不会出现问题。
此外,如果我在运行卸载之前手动停止了服务,我不会收到上述提示,但结果仍然相同。服务和文件都留下了。
这是我的 Wix 的一部分:
<Component Id='cmpService' Guid='{542f970e-ca39-4501-aae4-9e03eaac9a25}' >
<File Id='ServiceExeFile' Name='nls.service.agent.exe'
ReadOnly='no' Compressed='yes' KeyPath='yes' Vital='yes' Hidden='no' System='no'
Checksum='no' />
<ServiceInstall Id='MyServiceInstall' DisplayName='RaMP Data Collector' Name='rampDataCollector'
ErrorControl='normal' Start='auto' Type='ownProcess' Vital='yes'
Account='NT AUTHORITY\NETWORK SERVICE' />
<ServiceControl Id='MyServiceControl' Name='rampDataCollector'
Start='install' Stop='uninstall' Remove='uninstall' Wait='yes' />
</Component>
我试过了
- 取消 Account='NT AUTHORITY\NETWORK SERVICE' 得到同样的结果
- 更改我所有的 Guid 以确保得到相同的结果。
- 查看两种情况的详细日志(卸载前运行的服务和卸载前停止的服务),但我没有看到任何可以解读的有趣内容。
以下是我运行卸载并首先手动停止服务时的 msi 日志中的片段。我粘贴了服务组件和 MSI 操作周围的部分。
MSI (s) (A4:58) [10:44:11:080]: Component: cmpService; Installed: Local; Request: Absent; Action: Null
MSI (s) (A4:58) [10:44:11:080]: Component: cmpFolderPermissions; Installed: Local; Request: Absent; Action: Absent
MSI (s) (A4:58) [10:44:11:080]: Component: cmpApplicationShortcut; Installed: Local; Request: Absent; Action: Absent
与
MSI (s) (A4:58) [10:44:11:876]: Doing action: StopServices
Action ended 10:44:11: SchedSecureObjectsRollback. Return value 1.
Action start 10:44:11: StopServices.
MSI (s) (A4:58) [10:44:11:878]: Doing action: DeleteServices
Action ended 10:44:11: StopServices. Return value 1.
Action start 10:44:11: DeleteServices.
MSI (s) (A4:58) [10:44:11:879]: Doing action: RemoveRegistryValues
Action ended 10:44:11: DeleteServices. Return value 1.
任何帮助将不胜感激。
我想作为最后的手段,我可以使用 sc 命令执行自定义操作并在卸载时停止/删除服务。
【问题讨论】:
-
经过进一步测试。我认为exe可能有点“奇怪”。如果我有相同的安装设置一个带有简单测试 exe 的服务,它可以很好地安装和卸载。我不太确定 exe 有什么奇怪的地方。我将不得不与编写 id 的开发人员交谈。
标签: wix windows-installer wix3.5