卸载时未删除Windows服务(WIX 3)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了卸载时未删除Windows服务(WIX 3)相关的知识,希望对你有一定的参考价值。
我用WIX安装程序3创建了安装程序,它安装了Windows服务。
它安装服务很好,但当我卸载它时,服务没有删除。
- 我正在使用ServiceInstall和ServiceControl。 我只使用servicecontrol卸载服务而不是启动。
- 虽然卸载过程运行顺利,但不会删除该服务。
- 日志不显示错误。
- 完成卸载后,文件夹中没有文件。
- 卸载期间服务未运行 - 因此没有卡住进程的问题。
- 设置在我提前保存的清洁环境中运行。
- 我已经尝试替换我的设置中所有组件的所有GUID。
可以指出我在代码中做错了什么或建议另一个解决方案。
这是代码:
Component Id="ServiceComponentMain" Guid="{B652D08C-B99D-4CAC-9BCB-A48DF2356C9B}">
<File Id="ApiProxy.Service.exe" KeyPath="yes" Source="$(var.BasePath)ApiProxy.Service.exe" />
<ServiceInstall
Id="ServiceComponentMain"
Type="ownProcess"
Vital="yes"
Name="ApiProxy"
DisplayName="ApiProxy"
Start="auto"
Account="LocalSystem"
ErrorControl="critical"
Interactive="no"/>
<ServiceControl Id="StartService" Name="ServiceComponentMain" Stop="both" Remove="uninstall" Wait="yes" />
</Component>
这是日志:
Action ended 13:51:46: InstallInitialize. Return value 1.
MSI (s) (84:18) [13:51:46:547]: Doing action: ProcessComponents
Action 13:51:46: ProcessComponents. Updating component registration
Action start 13:51:46: ProcessComponents.
1: Updating component registration
Action ended 13:51:46: ProcessComponents. Return value 1.
MSI (s) (84:18) [13:51:46:563]: Doing action: UnpublishFeatures
Action 13:51:46: UnpublishFeatures. Unpublishing Product Features
Action start 13:51:46: UnpublishFeatures.
UnpublishFeatures: Feature: Unpublishing Product Features
Action ended 13:51:46: UnpublishFeatures. Return value 1.
MSI (s) (84:18) [13:51:46:568]: Doing action: StopServices
Action 13:51:46: StopServices. Stopping services
Action start 13:51:46: StopServices.
StopServices: Service: Stopping services
Action ended 13:51:46: StopServices. Return value 1.
MSI (s) (84:18) [13:51:46:577]: Doing action: DeleteServices
Action 13:51:46: DeleteServices. Deleting services
Action start 13:51:46: DeleteServices.
DeleteServices: Service: Deleting services
Action ended 13:51:46: **DeleteServices. Return value 1**.
MSI (s) (84:18) [13:51:46:662]: Doing action: RemoveFiles
Action 13:51:46: RemoveFiles. Removing files
Action start 13:51:46: RemoveFiles.
MSI (s) (84:18) [13:51:46:664]: Note: 1: 2205 2: 3: RemoveFile
RemoveFiles: File: Removing files, Directory:
MSI (s) (84:18) [13:51:46:677]: Note: 1: 2205 2: 3: RemoveFile
Action ended 13:51:46: RemoveFiles. Return value 0.
MSI (s) (84:18) [13:51:46:678]: Doing action: RemoveFolders
Action 13:51:46: RemoveFolders. Removing folders
Action start 13:51:46: RemoveFolders.
RemoveFolders: Folder: Removing folders
Action ended 13:51:46: RemoveFolders. Return value 1.
答案
ServiceControl元素中给出的名称应与ServiceInstall元素中给出的服务名称匹配。
以上是关于卸载时未删除Windows服务(WIX 3)的主要内容,如果未能解决你的问题,请参考以下文章
WiX 刻录包安装程序 - 升级安装时未更新 ExePackage