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>