AssemblyInstaller.Commit(IDictionary) メソッド

定義

インストール トランザクションを完了します。

public:
 override void Commit(System::Collections::IDictionary ^ savedState);
public override void Commit(System.Collections.IDictionary savedState);
override this.Commit : System.Collections.IDictionary -> unit
Public Overrides Sub Commit (savedState As IDictionary)

パラメーター

savedState
IDictionary

インストーラー コレクション内のすべてのインストーラーが実行された後のコンピューターの状態を含む IDictionary

例外

savedState パラメーターはnull

-又は-

保存された状態の IDictionary が破損している可能性があります。

-又は-

ファイルが見つかりませんでした。

コレクション内のいずれかのインストーラーの Committing イベント ハンドラーでエラーが発生しました。

-又は-

コレクション内のいずれかのインストーラーの Committed イベント ハンドラーでエラーが発生しました。

-又は-

インストールの Commit(IDictionary) フェーズ中に例外が発生しました。 例外は無視され、インストールは続行されます。 ただし、インストールが完了すると、アプリケーションが正しく機能しない可能性があります。

-又は-

インストーラーの種類がいずれかのアセンブリで見つかりませんでした。

-又は-

インストーラーの種類の 1 つのインスタンスを作成できませんでした。

インストールの Commit(IDictionary) フェーズ中に例外が発生しました。 例外は無視され、インストールは続行されます。 ただし、インストールが完了すると、アプリケーションが正しく機能しない可能性があります。

次の例では、AssemblyInstaller コンストラクターと、Install クラスのCommitメソッドとAssemblyInstaller メソッドを示します。

AssemblyInstaller クラスは、AssemblyInstaller コンストラクターを呼び出すことによって作成されます。 このオブジェクトのプロパティが設定され、Install アセンブリをインストールするためにCommitメソッドとMyAssembly_Install.exe メソッドが呼び出されます。

#using <System.dll>
#using <System.Configuration.Install.dll>

using namespace System;
using namespace System::Configuration::Install;
using namespace System::Collections;
using namespace System::Collections::Specialized;
void main()
{
   IDictionary^ mySavedState = gcnew Hashtable;
   Console::WriteLine( "" );
   try
   {
      // Set the commandline argument array for 'logfile'.
      array<String^>^myString = {"/logFile=example.log"};
      
      // Create an Object* of the 'AssemblyInstaller' class.
      AssemblyInstaller^ myAssemblyInstaller = gcnew AssemblyInstaller;

      // Set the properties to install the required assembly.
      myAssemblyInstaller->Path = "MyAssembly_Install.exe";
      myAssemblyInstaller->CommandLine = myString;
      myAssemblyInstaller->UseNewContext = true;
      
      // Clear the 'IDictionary' Object*.
      mySavedState->Clear();
      
      // Install the 'MyAssembly_Install' assembly.
      myAssemblyInstaller->Install( mySavedState );
      
      // Commit the 'MyAssembly_Install' assembly.
      myAssemblyInstaller->Commit( mySavedState );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( e );
   }
}
using System;
using System.Configuration.Install;
using System.Collections;
using System.Collections.Specialized;

class MyInstallClass
{
   static void Main()
   {
      IDictionary mySavedState = new Hashtable();

      Console.WriteLine( "" );

      try
      {
         // Set the commandline argument array for 'logfile'.
         string[] myString = new string[ 1 ];
         myString[ 0 ] = "/logFile=example.log";

         // Create an object of the 'AssemblyInstaller' class.
         AssemblyInstaller myAssemblyInstaller = new AssemblyInstaller();

         // Set the properties to install the required assembly.
         myAssemblyInstaller.Path = "MyAssembly_Install.exe";
         myAssemblyInstaller.CommandLine = myString;
         myAssemblyInstaller.UseNewContext = true;

         // Clear the 'IDictionary' object.
         mySavedState.Clear();

         // Install the 'MyAssembly_Install' assembly.
         myAssemblyInstaller.Install( mySavedState );

         // Commit the 'MyAssembly_Install' assembly.
         myAssemblyInstaller.Commit( mySavedState );
      }
      catch( Exception )
      {
      }
   }
}
Imports System.Configuration.Install
Imports System.Collections
Imports System.Collections.Specialized

Class MyInstallClass
   
   Shared Sub Main()
      Dim mySavedState = New Hashtable()
      
      Console.WriteLine("")
      

      Try
         ' Set the commandline argument array for 'logfile'.
         Dim myString(0) As String
         myString(0) = "/logFile=example.log"
         ' Create an object of the 'AssemblyInstaller' class.
         Dim myAssemblyInstaller As New AssemblyInstaller()
         ' Set the properties to install the required assembly.
         myAssemblyInstaller.Path = "MyAssembly_Install.exe"
         myAssemblyInstaller.CommandLine = myString
         myAssemblyInstaller.UseNewContext = True
         
         ' Clear the 'IDictionary' object.
         mySavedState.Clear()
         
         ' Install the 'MyAssembly_Install' assembly.
         myAssemblyInstaller.Install(mySavedState)
         
         ' Commit the 'MyAssembly_Install' assembly.
         myAssemblyInstaller.Commit(mySavedState)
      Catch
      End Try

   End Sub
End Class

注釈

このメソッドは、このインスタンスのすべてのインストーラーの Install メソッドが成功した場合にのみ呼び出 InstallerCollection 。 このメソッドは、コレクション内の各インストーラーの Commit メソッドを呼び出します。

正しいアンインストール操作を実行するために必要な情報を、IDictionary メソッドに渡される保存済み状態のUninstallに格納します。

適用対象