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) 단계를 수행하는 동안 예외가 발생한 경우. 예외는 무시되고 설치 작업이 계속됩니다. 그러나 설치가 완료된 후 애플리케이션이 제대로 작동하지 않을 수 있습니다.

또는

어셈블리 중 하나에 설치 관리자 형식이 없는 경우

또는

설치 관리자 형식 중 하나의 인스턴스를 만들 수 없는 경우

설치의 Commit(IDictionary) 단계를 수행하는 동안 예외가 발생한 경우. 예외는 무시되고 설치 작업이 계속됩니다. 그러나 설치가 완료된 후 애플리케이션이 제대로 작동하지 않을 수 있습니다.

예제

다음 예제에서는 생성자와 클래스의 InstallCommit 메서드를 보여 AssemblyInstaller 줍니다AssemblyInstaller.

AssemblyInstaller 클래스는 생성자를 호출하여 AssemblyInstaller 만듭니다. 이 개체의 속성이 설정되고 및 InstallCommit 메서드가 호출되어 어셈블리를 설치합니다 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

설명

이 메서드는 이 instance 있는 모든 설치 관리자의 InstallerCollection 메서드가 성공한 경우에만 Install 호출됩니다. 그런 다음 이 메서드는 컬렉션에 Commit 있는 각 설치 관리자의 메서드를 호출합니다.

메서드에 전달되는 저장된 상태 IDictionary에서 올바른 제거 작업을 수행해야 할 Uninstall 수 있는 정보를 저장합니다.

적용 대상