AssemblyInstaller.Commit(IDictionary) Methode

Definition

Schließt die Installationstransaktion ab.

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)

Parameter

savedState
IDictionary

Ein IDictionary Element, das den Status des Computers enthält, nachdem alle Installationsprogramme in der Installationsprogrammsammlung ausgeführt wurden.

Ausnahmen

Der savedState Parameter ist null.

-oder-

Möglicherweise ist der gespeicherte Zustand IDictionary beschädigt.

-oder-

Eine Datei konnte nicht gefunden werden.

Fehler im Committing Ereignishandler eines der Installationsprogramme in der Auflistung.

-oder-

Fehler im Committed Ereignishandler eines der Installationsprogramme in der Auflistung.

-oder-

Ausnahme während der Commit(IDictionary) Phase der Installation. Die Ausnahme wird ignoriert, und die Installation wird fortgesetzt. Die Anwendung funktioniert jedoch nach Abschluss der Installation möglicherweise nicht ordnungsgemäß.

-oder-

Installer-Typen wurden in einer der Assemblys nicht gefunden.

-oder-

Eine Instanz eines der Installer-Typen konnte nicht erstellt werden.

Ausnahme während der Commit(IDictionary) Phase der Installation. Die Ausnahme wird ignoriert, und die Installation wird fortgesetzt. Die Anwendung funktioniert jedoch nach Abschluss der Installation möglicherweise nicht ordnungsgemäß.

Beispiele

Im folgenden Beispiel wird der AssemblyInstaller Konstruktor und die InstallCommit Methoden der AssemblyInstaller Klasse veranschaulicht.

Eine AssemblyInstaller Klasse wird durch Aufrufen des AssemblyInstaller Konstruktors erstellt. Die Eigenschaften dieses Objekts werden festgelegt, und die Install Methoden Commit werden aufgerufen, um die MyAssembly_Install.exe Assembly zu installieren.

#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

Hinweise

Diese Methode wird nur aufgerufen, wenn die Install Methoden aller Installationsprogramme in dieser Instanz InstallerCollection erfolgreich sind. Diese Methode ruft dann die Commit Methode der einzelnen Installationsprogramme in der Auflistung auf.

Speichern Sie alle Informationen, die Sie möglicherweise benötigen, um einen korrekten Deinstallationsvorgang im gespeicherten Zustand IDictionaryauszuführen, der an die Uninstall Methode übergeben wird.

Gilt für: