2010-09-09 33 views
2

我有一个简单的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调用也是如此,这可能会在生产代码中以不同的方式处理。

谢谢!

回答

1

如果有其他人可能会遇到这种情况,事实证明我在代码中遇到了一个异常,我没有处理,所以它一直传递到Windows Installer,它看到异常作为失败并将其回滚。

相关问题