Wix を使用してサービスをアンインストールしているときにのみカスタム アクションを実行するのに問題があります。
<CustomAction Id='InstallService'
FileKey='Service.exe'
ExeCommand='install'
Execute='immediate'
Return='check'
Impersonate='yes'>NOT Installed</CustomAction>
<CustomAction Id='UninstallService'
FileKey='Service.exe'
ExeCommand='uninstall'
Execute='immediate'
Return='check'
Impersonate='yes'>Installed AND NOT REINSTALL</CustomAction>
<InstallExecuteSequence>
<Custom Action='UninstallService' After='StopServices'/>
<Custom Action='InstallService' Before='StartServices'/>
</InstallExecuteSequence>
これはコンポーネントです...
<Component Id="ProductComponent">
<File Id="MyService.exe"
Name="MyService.exe"
Source="..\MyService\bin\Release\MyService.exe"
Vital="yes"
KeyPath="yes"
DiskId="1"/>
...
<ServiceControl Id='ServiceControl'
Name='MyService'
Start='install'
Stop='both'/>
</Component>
インストーラーを実行すると、エラーが発生します。イベントログを見ると、これが見つかりました...
製品: MyService -- エラー 1721。この Windows インストーラー パッケージには問題があります。このインストールを完了するために必要なプログラムを実行できませんでした。サポート担当者またはパッケージ ベンダーにお問い合わせください。アクション: UninstallService、場所: C:\Program Files (x86)\MyService\MyService.exe、コマンド: uninstall
私もこれを試しました...
<CustomAction Id='UninstallService'
FileKey='Service.exe'
ExeCommand='uninstall'
Execute='immediate'
Return='check'
Impersonate='yes'>Installed AND NOT UPGRADINGPRODUCTCODE</CustomAction>
注: TopShelf.NETを使用しているため、サービスのインストール/アンインストールにカスタム アクションを使用しています。