AssemblyInstaller.Install(IDictionary) 메서드

정의

설치를 수행합니다.

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

매개 변수

savedState
IDictionary

커밋, 롤백 또는 제거 작업 수행에 필요한 정보를 저장하는 데 사용되는 IDictionary입니다.

예외

savedState 매개 변수가 null인 경우

또는

파일을 찾을 수 없는 경우

컬렉션에 있는 설치 관리자 중 하나의 BeforeInstall 이벤트 처리기에 예외가 발생한 경우

또는

컬렉션에 있는 설치 관리자 중 하나의 AfterInstall 이벤트 처리기에 예외가 발생한 경우

또는

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

또는

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

예제

다음 예제에서는 생성자와 클래스의 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

설명

이 메서드를 호출 합니다 Install 에 포함 된 각 설치 관리자의 메서드는 Installers 이 인스턴스의 속성입니다. IDictionary 매개 변수에 지정된 savedState 개체는 포함된 설치 관리자가 실행된 후 설치의 상태 반영하도록 업데이트됩니다. 모든 경우는 Install 메서드 성공는 Commit 메서드가 호출 됩니다. 그렇지 않으면 메서드가 Rollback 호출됩니다.

호출자 참고

IDictionary 에 지정 된 된 savedState 매개 변수를 전달 하는 경우에 비어 있어야 합니다.는 Install(IDictionary) 메서드.

적용 대상