4

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を使用しているため、サービスのインストール/アンインストールにカスタム アクションを使用しています。

4

1 に答える 1

4

最善の策は、カスタム アクションのアクションをコンポーネントのアクション状態に関連付けることです。

<InstallExecuteSequence>
   <Custom Action="UninstallService">$ProductComponent=2</Custom>
   <Custom Action="InstallService">$ProductComponent=3</Custom>
</InstallExecuteSequence>

CustomActionまた、要素を にする必要がありますExecute='deferred'

また、CustomAction要素内のテキストは、スクリプト カスタム アクションを作成している場合にのみ許可されます。それがあなたがしていることのようには見えません。

カスタム アクションを追加するには、かなりの理解が必要です。残念なことに、サードパーティのプラットフォームではカスタム アクションの使用が強制されます

于 2013-03-20T03:41:26.447 に答える