2

SQL データベースを作成するために提供されたカスタム アクションを使用する Windows 7 (msiexec.exe のプロパティによると Windows インストーラー 5.0.7600.16385) に単純な WiX (3.5.2030.0) インストーラーがあります。MSI を単独で実行するか、C# セットアップ ブートストラップ (相互運用に DTF を使用) のトランザクションで実行すると、正しく動作します。

ブートストラッパーで MSI を実行し、外部 UI ハンドラーにフックすると (動作中のコードからの唯一の変更は、次のような呼び出しです。

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 ハンドラーのフックは、データベース作成の実行とどのような関係がありますか?

「return MessageResult.None」で短絡するとすべてが機能するため、問題が外部 UI ハンドラー コードに関連していることはわかっています。

私の最上位のハンドラ コードは以下のとおりです。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 がまだ起動するように "None" を返しています。明らかに、これは生産前に変更する必要があります。同じことが MessageBox 呼び出しにも当てはまりますが、実稼働コードでは異なる方法で処理される可能性があります。

ありがとう!

4

1 に答える 1

1

他の誰かがこれに遭遇する可能性がある場合に備えて、私が処理していないコードで例外が発生していたことが判明したため、Windows インストーラーまでずっと渡されていました。ロールバックします。

于 2010-09-13T15:42:53.463 に答える