我有一个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>
答案 0 :(得分:0)
除了ServiceInstall
元素之外,我会添加两个相同的组件并调整组件,因此只安装了一个组件。像:
<Condition>DOMAINNAME And USERNAME And PASSWORD</Condition>
恰恰相反:
<Condition>Not(DOMAINNAME And USERNAME And PASSWORD)</Condition>