我有一個簡單的Windows 7上的WiX(3.5.2030.0)安裝程序(根據msiexec.exe屬性的Windows Installer 5.0.7600.16385)使用提供的自定義操作來創建SQL數據庫。當我單獨運行MSI,或者在C#安裝程序引導程序(使用DTF進行互操作)中的事務中運行它時,它可以正常工作。WiX 3.5.2030.0 CreateDatabase失敗,1603與DTF外部UI處理程序,沒有外部UI處理程序工作
當我在外部用戶界面處理的引導程序和鉤運行MSI(從工作一個唯一的代碼的變化是這樣的呼叫:
Installer.SetExternalUI(ExternalUIHandler, ilm);
),然而,所述的CreateDatabase調用失敗。 SQL日誌中沒有任何相關內容 - 它顯示正在啓動的數據庫。在SQL事件探查器中沒有任何相關的東西 - 它顯示CA檢查數據庫的存在,然後在創建失敗後嘗試刪除。下面就是一個調試詳細的日誌顯示:
MSI (s) (74:F4) [16:42:59:213]: Executing op: ActionStart(Name=CreateDatabase,Description=Creating Databases,)
MSI (s) (74:F4) [16:42:59:243]: Executing op: CustomActionSchedule(Action=CreateDatabase,ActionType=25601,Source=BinaryData,Target=**********,CustomActionData=**********)
MSI (s) (74:F4) [16:42:59:253]: Creating MSIHANDLE (769) of type 790536 for thread 5876
MSI (s) (74:A4) [16:42:59:253]: Invoking remote custom action. DLL: C:\Windows\Installer\MSID856.tmp, Entrypoint: CreateDatabase
MSI (s) (74!7C) [16:43:01:493]: Creating MSIHANDLE (770) of type 790531 for thread 8060
MSI (s) (74!7C) [16:43:01:513]: Closing MSIHANDLE (770) of type 790531 for thread 8060
CustomAction CreateDatabase returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
MSI (s) (74:A4) [16:43:14:682]: Closing MSIHANDLE (769) of type 790536 for thread 5876
注意,日誌不顯示有用的SQL錯誤代碼 - 只是(總是沒用)1603錯誤(翻譯:什麼破)。
外部UI處理程序中的鉤子與運行數據庫創建有什麼關係?
我知道這個問題與我的外部UI處理程序代碼有關,因爲如果我用「return MessageResult.None」將它短路,那麼一切正常。
我的頂級處理程序代碼如下;它是基於http://msdn.microsoft.com/en-us/library/aa368786(VS.85).aspx:
switch (messageType) {
case InstallMessage.FatalExit:
MessageBox.Show("FATAL EXIT: " + message, "Fatal exit",
MessageBoxButtons.OK, MessageBoxIcon.Error);
break;
case InstallMessage.Error:
MessageBox.Show("ERROR: " + message, "Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
break;
case InstallMessage.Warning:
MessageBox.Show("WARNING: " + message, "Warning",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
break;
case InstallMessage.User:
// nothing to do here
break;
case InstallMessage.Info:
// nothing to do here
break;
case InstallMessage.FilesInUse:
MessageBox.Show("Files in use: " + message, "Files in use",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
break;
case InstallMessage.ResolveSource:
// nothing to do here
break;
case InstallMessage.OutOfDiskSpace:
MessageBox.Show("OUT OF DISK SPACE: " + message,
"Out of disk space", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
break;
case InstallMessage.ActionStart:
_enableActionData = false;
ProcessActionStart(message);
break;
case InstallMessage.ActionData:
ProcessActionDataMessage(message);
break;
case InstallMessage.Progress:
// http://msdn.microsoft.com/en-us/library/aa370573(VS.85).aspx
ProcessProgressData(message);
break;
case InstallMessage.CommonData:
// ignore for now
break;
case InstallMessage.Initialize:
case InstallMessage.Terminate:
SetHighLevelStatus(messageType.ToString());
break;
case InstallMessage.ShowDialog:
// nothing to do here
break;
}
AddDetailedStatusLine("... " + messageType + ":" + message);
return MessageResult.None;
//return MessageResult.OK;
因爲完整的UI還沒有實現,只是進度部分,現在,我要回「無」,使得內部UI仍是起火。顯然這需要在生產之前進行更改。 MessageBox調用也是如此,這可能會在生產代碼中以不同的方式處理。
謝謝!