これは私がPhil Wilsons ReadSvcXml.exeツールを使用して、セットアッププロジェクトでポストビルドイベントとして実行すると、サービスに特定の情報を含むインストーラmsiファイルを更新します(依存性の追加、アンインストール時のサービスの停止など)それを登録するなど)。これは、インストールの完了時にサービスを自動的に開始する最も簡単で信頼性の高い方法です。
セットアッププロジェクトのための
例:ポストビルドイベントは次のとおりです。
SvcInstallができ
<ServiceData>
<FileName>MyServiceHost.exe</FileName>
<ServiceInstall>
<Id>ServiceInstallColumn</Id>
<Name>GatewayServer</Name>
<DisplayName>Company MyServer</DisplayName>
<ServiceType>ownprocess </ServiceType> <!-- or shareprocess-->
<Interactive>no</Interactive>
<Start>auto</Start> <!--auto demand or disabled-->
<ErrorControl>
<!--ignore normal critical -->
normal
</ErrorControl>
<Dependencies>MSSQLSERVER</Dependencies>
<Description>MyServer for blar blar blar</Description>
</ServiceInstall>
<ServiceControl>
<Name>MyServerName</Name>
<Id>MyServerId</Id>
<!-- install, uninstall or both-->
<Start>install</Start>
<Stop>both</Stop>
<Remove>uninstall</Remove>
<Wait>no</Wait> <!-- no yes -->
</ServiceControl>
</ServiceData>
:ServiceSetup.xmlがどのように見える .. \ ReadSvcXml.exe MyApplication.msi .. \ ServiceSetup.xml
ここをクリックしてください:
download svcinstall bin and source
上記の手順は正常です。それはあなたが知りたかったことですか? – Mrchief