我有一个用于 Windows 服务的 wix 安装程序。根据要求,如果域名、用户名和密码都给出了,那么服务应该使用该用户帐户安装,否则服务应该在安装后在本地系统上运行。
如何根据条件设置帐户?下面是服务安装的代码:
<Component Id="CMPFa85281c3_a329_4a93_a1d7_203fbccec31f" Guid="*" Directory="INSTALLLOCATION">
<Condition>
<![CDATA[Installed OR (SVCINSTALL <> 0)]]>
</Condition>
<RemoveFile Id="RmFa85281c3_a329_4a93_a1d7_203fbccec31f" Name="MyService.exe" On="both" />
<File Id="Fa85281c3_a329_4a93_a1d7_203fbccec31f" Source="$(var.BaseDir)\MyService.exe" KeyPath="yes" />
<ServiceInstall Id="InstallWindowsService" Name="$(var.SvcName)"
DisplayName="$(var.SvcDisplayName)"
Start="auto"
ErrorControl="normal"
Type="ownProcess"
Account="LocalSystem"
Description="$(var.SvcDescription)"/>
<ServiceControl Id="sc_InstallWindowsService" Name="$(var.SvcName)" Start="install" Remove="uninstall" Stop="both" Wait="no"/>
</Component>