大規模なアプリをインストールしています。その一部は、ターゲット データベースに対して SQL スクリプトを大量に実行するための「DbUpdateManager」と呼ばれるカスタム作成ツールです。
現在、WiX 2.x のインストールは機能していますが、1 つの欠点があります。インストール中に、必要に応じてすぐに開始できる Windows サービスもいくつかインストールします。ただし、DbUpdateManager がまだ実行されていない場合、これらは失敗します。
だから私が達成しようとしているのはこれです:
- MSI から DbUpdateManager とサービスをインストールする
- サービスを開始する前に DbUpdateManager を実行します。
現在の WiX ソースは次のようになります。
<Directory Id='INSTALLDIR' Name='DbUpdMgr' LongName='DbUpdateManager' >
<!-- DbUpdateManager component with the necessary files -->
<Component Id='DbUpdateManagerComponent' Guid='...' DiskId='1'>
<File Id='DbUpdateManagerFile' LongName='DbUpdateManager.Wizard.exe'
Name='DbUmWz.exe' src='DbUpdateManager.Wizard.exe' KeyPath='no' />
</Component>
<!-- Component to install one of my Windows services -->
<Component Id='InstallServiceComponent' Guid='...' DiskId='1'>
<File Id='InstallServiceFile' LongName='MyService.exe'
Name='MyServic.exe' src='MyService.exe' KeyPath='yes'/>
<ServiceInstall Id='InstallMyService' Name='MyService'
Description='My Service' ErrorControl='normal'
Start='auto' Type='ownProcess' Vital='yes' />
<ServiceControl Id='UninstallMyService' Name='MyService'
Remove='uninstall' Wait='yes' />
</Component>
<!-- Feature for the DbUpdateManager referencing the above component -->
<Feature Id='DbUpdateManager' ConfigurableDirectory='INSTALLDIR'
AllowAdvertise='no' Description='DbUpdateManager' Level='1'
Title='Database Update Manager'>
<ComponentRef Id='DbUpdateManagerComponent'/>
</Feature>
<!-- Custom action for running DbUpdateManager -->
<CustomAction Id='RunDbUpdateManagerAction' FileKey='DbUpdateManagerFile'
ExeCommand='' Return='asyncWait' />
<!-- Calling the custom action in the install sequence -->
<InstallExecuteSequence>
<RemoveExistingProducts After='InstallInitialize' />
<Custom Action='RunDbUpdateManagerAction'
After='InstallFinalize'>&DbUpdateManager=3</Custom>
私はこの WIX を継承しましたが、動作しますが、前述したように、DbUpdateManager がプロセスの後半で呼び出されるため ("After=InstallFinalize" のみ)、サービスは最初は適切に起動しません (2 回目は正常に実行されます)。 DbUpdateManager の実行後に手動で再起動したときなど)。
MSI のドキュメントを少し調べたところ、「StartServices」と呼ばれる適切な手順が見つかりました。そのため、カスタム アクションの呼び出しを次のように変更することにしました。
<InstallExecuteSequence>
<Custom Action='RunDbUpdateManagerAction'
Before='StartServices'>&DbUpdateManager=3</Custom>
残念ながら、この場合、何も起こりません.DbUpdateManagerは決して呼び出されません....
理由はありますか?MSI/WiX のデバッグは本当に大変で、もう木を見て森を見ているようには見えません....
ありがとう!マルク
編集:「RunDbUpdateManagerAction」は、MSIのInstallExecuteSequenceテーブルの正しい位置に配置されます-InstallServicesの直後、StartServicesの直前-それでも機能しません.... DbUpdateManager(Winformsユーティリティ)は実行中に表示されませんインストール:-(
編集 2: アクションが適切なタイミングで実行されているように見えます。残念ながら、ウィザードが表示されません :-( 表示されているのは、「MSI サービス開始できませんでした" - wtf ???
MSI (s) (2C:D8) [20:53:36:383]: アクションを実行中: RunDbUpdateManagerAction アクション 20:53:36: RunDbUpdateManagerAction。アクションは 20:53:36 に開始されました: RunDbUpdateManagerAction。MSI (s) (2C:D8) [20:53:36:383]: アクションを実行中: StartServices アクション 20:53:36: StartServices。サービスが開始されています 20:53:36 にアクションが開始されました: StartServices。アクションは 20:53:36 に終了しました: RunDbUpdateManagerAction。戻り値 1631。