2017-05-31 47 views
0

我是Wix的新手。在安裝msi時,我想使用util:CloseApplication來檢測notepad.exe是否正在運行。我簡單的代碼。如何修復WixCloseApplications:錯誤0x8007064f:未能打開數據庫視圖?

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" 
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> 

<util:CloseApplication CloseMessage="no" Target="notepad.exe" RebootPrompt="no"/> 

<InstallExecuteSequence> 
    <Custom Action="WixCloseApplications" After="InstallInitialize"/> 
</InstallExecuteSequence> 

無法在Wix 3.10和3.11工具集中使用。任何建議? 也嘗試執行WixCloseApplications Before="InstallValidate"。同樣的結果。

MSI日誌文件:(時間戳剝去)

MSI (s) (6C:90) [10:47:42:356]: Doing action: WixCloseApplications 
Action 10:47:42: WixCloseApplications. 
Action start 10:47:42: WixCloseApplications. 
MSI (s) Creating MSIHANDLE (1) of type 790542 for thread 60816 
MSI (s) Invoking remote custom action. DLL: C:\Windows\Installer\MSI95B2.tmp, Entrypoint: WixCloseApplications 
MSI (s) Generating random cookie. 
MSI (s) Created Custom Action Server with PID 57776 (0xE1B0). 
MSI (s) Running as a service. 
MSI (s) Hello, I'm your 32bit Impersonated custom action server. 
MSI (s) Creating MSIHANDLE (2) of type 790541 for thread 60964 
MSI (s) Note: 1: 2205 2: 3: WixCloseApplication 
MSI (s) Note: 1: 2228 2: 3: WixCloseApplication 4: SELECT `WixCloseApplication`, `Target`, `Description`, `Condition`, `Attributes`, `Property`, `TerminateExitCode`, `Timeout` FROM `WixCloseApplication` ORDER BY `Sequence` 
MSI (s) Creating MSIHANDLE (3) of type 790531 for thread 60964 
WixCloseApplications: Error 0x8007064f: failed to open view on database 
MSI (s) Closing MSIHANDLE (3) of type 790531 for thread 60964 
MSI (s) Creating MSIHANDLE (4) of type 790531 for thread 60964 
WixCloseApplications: Error 0x8007064f: failed to open view on WixCloseApplication table 
MSI (s) Closing MSIHANDLE (4) of type 790531 for thread 60964 
MSI (s) Closing MSIHANDLE (2) of type 790541 for thread 60964 
CustomAction WixCloseApplications returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox) 
MSI (s) Closing MSIHANDLE (1) of type 790542 for thread 60816 
Action ended 10:47:42: WixCloseApplications. Return value 3. 
MSI (s) Machine policy value 'DisableRollback' is 0 
MSI (s) Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 
MSI (s) Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 
MSI (s) Calling SRSetRestorePoint API. dwRestorePtType: 13, dwEventType: 103, llSequenceNumber: 958, szDescription: "". 
MSI (s) The call to SRSetRestorePoint API succeeded. Returned status: 0. 
MSI (s) Unlocking Server 
Action ended 10:47:42: INSTALL. Return value 3. 
+0

忘了提。我不想使用任何像taskkill或WixQuietExec。我不想殺死exe文件。只是想讓用戶知道,然後退出安裝。即使使用CloseMessage =「yes」。同樣的結果。 –

回答

0

我想我已經找到了我所經歷的問題的根本原因。 如果我將完整的ClosApplication代碼放入<Fragment></Fragment>中,則會跳過整個代碼片段(僅僅是由於缺少引用)。

<Fragment> 
    <util:CloseApplication ID="StopNotepad" CloseMessage="no" Target="notepad.exe" RebootPrompt="no"/> 

    <InstallExecuteSequence> 
     <Custom Action="WixCloseApplications" After="InstallInitialize"/> 
    </InstallExecuteSequence> 
</Fragment> 

我以前看到的問題稍有不同。我的片段只包含這個

<Fragment> 
    <util:CloseApplication ID="StopNotepad" CloseMessage="no" Target="notepad.exe" RebootPrompt="no"/> 
</Fragment> 

所需的自定義操作包含在外部wxi文件中。最終的msi包含對自定義操作的調用,但缺少Util:CloseApplication聲明。其結果是,微星未能部署,我看到了怪異的日誌條目,表明WixCloseApplications: Error 0x8007064f: failed to open view on database

解決方案: 通過移動<util:CloseApplication片段代碼<Product><\Product>內或其他現有<Fragment>有向外界提供參考。例如,Directory Id=等將解決該問題。

除非有辦法包括<util:CloseApplication參考(我不知道),不要把<util:CloseApplication代碼放在它自己的片段中!

相關問題