Aracılığıyla paylaş


AssemblyInstaller.Install(IDictionary) Yöntem

Tanım

Yüklemeyi gerçekleştirir.

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)

Parametreler

savedState
IDictionary

İşleme IDictionary , geri alma veya kaldırma işlemi gerçekleştirmek için gereken bilgileri kaydetmek için kullanılan.

Özel durumlar

savedState parametresidirnull.

-veya-

Dosya bulunamadı.

Koleksiyondaki BeforeInstall yükleyicilerden birinin olay işleyicisinde özel durum oluştu.

-veya-

Koleksiyondaki AfterInstall yükleyicilerden birinin olay işleyicisinde özel durum oluştu.

-veya-

Yükleyici türleri derlemelerden birinde bulunamadı.

-veya-

Yükleyici türlerinden birinin örneği oluşturulamadı.

Örnekler

Aşağıdaki örnekte, sınıfının oluşturucu ve ve yöntemleri gösterilmektedir AssemblyInstallerAssemblyInstaller.CommitInstall

oluşturucu çağrılarak AssemblyInstaller sınıfının bir nesnesi AssemblyInstaller oluşturulur. Bu nesnenin özellikleri ayarlanır ve Install 'MyAssembly_Install.exe' derlemesini yüklemek için ve Commit yöntemleri çağrılır.

#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

Açıklamalar

Bu yöntem, bu örneğin özelliğinde bulunan her yükleyicinin Installers yöntemini çağırırInstall. IDictionary parametresi tarafından savedState belirtilen nesne, kapsanan yükleyiciler çalıştırıldıktan sonra yüklemenin durumunu yansıtacak şekilde güncelleştirilir. Tüm Install yöntemler başarılı olursa yöntemi Commit çağrılır. Aksi takdirde yöntemi Rollback çağrılır.

Arayanlara Notlar

IDictionary yöntemine savedState geçirildiğinde Install(IDictionary) parametresi tarafından belirtilen boş olmalıdır.

Şunlara uygulanır