WCF (selfhost) サービス (いくつかの dll ファイルと app.config) を含む Windows サービス プロジェクトがあります。これは Wix でインストールされます。
Wix セットアップ パッケージへの参照を追加しました。Product.wxs ファイルは次のようになります。
<?xml version="1.0" encoding="UTF-8"?>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="MyAppINSTALLDIR" Name="MyApp 5Service">
<Component Id="SampleServiceComponent" DiskId="1" Guid="6f51c0f3-776c-4aec-a200-1f199352c6c3" Win64="yes">
<File Id="MyApp.WindowsService.exe" Name="MyApp.WindowsService.exe" Source="$(var.MyApp .WindowsService.TargetDir)\MyApp.WindowsService.exe"/>
<ServiceInstall Id="InstallMyAppService" DisplayName="MyAppService" Name="MyApp .WindowsService.exe" Description="MyApp 5 Service - För effektivare och enklare operationsplanering" Account="NetworkService" ErrorControl="normal" Start="demand" Type="ownProcess" Vital="yes" />
<ServiceControl Id="ControlMyAppService" Name="MyApp5.WindowsService.exe" Stop="uninstall" Remove="uninstall" />
</Component>
</Directory>
</Directory>
<Property Id="WIXUI_INSTALLDIR" Value="MyAppINSTALLDIR" />
<UIRef Id="WixUI_InstallDir" />
<Feature Id="ProductFeature" Title="Wix_MyApp.WindowsService" Level="1">
<ComponentRef Id="SampleServiceComponent" />
</Feature>
<Media Id="1" Cabinet="SampleServiceComponent.cab" EmbedCab="yes" />
</Product>
そして、これはある程度機能し、いくつかの質問がありました:
- 現在、メインの Windows サービス exe ファイルのみが含まれていますか? Selfhost のすべての出力を含める必要があります
- インストールする前に Windows サービス プロジェクトの app.config を設定できるようにする必要があります (インストールされるサービスの名前を決定します)、圧縮を使用せずにセットアップを実行する前にファイルを設定することは可能ですか、それともセットアップ中に情報を取得しやすいですか?インストールして app.config に設定しますか?
編集1:
出力からすべてのファイルを取得するには、これに変更しましたが、機能しませんか? :
<File Id="MyApp.WindowsService.Output"
Name="$(var.MyApp.WindowsService.TargetFileName)"
Source="$(var.MyApp.WindowsService.TargetPath)"
KeyPath="yes" />
<ServiceInstall Id="InstallMyAppService" DisplayName="MyAppService" Name="MyApp.WindowsService.exe" Description="MyApp 5 Service - För effektivare och enklare operationsplanering" Account="NetworkService" ErrorControl="normal" Start="demand" Type="ownProcess" Vital="yes" />
<ServiceControl Id="ControlMyAppService" Name="MyApp.WindowsService.exe" Stop="uninstall" Remove="uninstall" />
</Component>