2
我有一个安装程序项目来安装Windows服务。该安装程序包含一个UI对话框,以允许用户指定服务名称。此服务名称存储到公共财产。安装程序成功创建具有指定名称的服务,但是当我尝试卸载它时,安装程序尝试使用默认服务名称属性(未由用户指定)停止和删除服务。Wix:使用用户指定的服务名称安装Windows服务
我的服务安装代码如下所示:
...
<Property Id="SERVICE_NAME" Value="Default_Service_Name" />
...
<Component Id="C.service.exe" Guid="...">
<File Id="service.exe" Name="$(var.service.TargetFileName)" KeyPath="yes" Vital="yes"
Source="$(var.service.TargetPath)" />
<ServiceInstall Id="MyServiceInstall" DisplayName="[SERVICE_NAME]" Account="[SERVICE_ACCOUNT]" Password="[SERVICE_PASSWORD]"
Name="[SERVICE_NAME]" ErrorControl="normal" Start="auto" Type="ownProcess" Vital="yes">
</ServiceInstall>
<ServiceControl Id="MyServiceStart" Name="[SERVICE_NAME]" Start="install" Wait="no" />
<ServiceControl Id="MyServiceStop" Name="[SERVICE_NAME]" Stop="both" Wait="yes" />
<ServiceControl Id="MyServiceRemove" Name="[SERVICE_NAME]" Remove="uninstall" Wait="yes" />
</Component>
...
也许我需要一些CA更新SerciceControl表后,用户将指定服务名称?