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, das den Zustand enthält, in dem sich der Computer nach Ausführen aller Installationsprogramme in der Auflistung der Installationsprogramme befindet.

Ausnahmen

Der savedState-Parameter ist null.

- oder -

Das IDictionary mit dem gespeicherten Zustand ist möglicherweise 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 -

Während der Commit(IDictionary)-Phase der Installation ist eine Ausnahme aufgetreten. Die Ausnahme wird ignoriert, und die Installation wird fortgesetzt. Nach Abschluss der Installation funktioniert die Anwendung jedoch möglicherweise nicht ordnungsgemäß.

- oder -

In einer der Assemblys wurden keine Installationsprogrammtypen gefunden.

- oder -

Für einen der Installationsprogrammtypen konnte keine Instanz erstellt werden.

Während der Commit(IDictionary)-Phase der Installation ist eine Ausnahme aufgetreten. Die Ausnahme wird ignoriert, und die Installation wird fortgesetzt. Nach Abschluss der Installation funktioniert die Anwendung jedoch möglicherweise nicht ordnungsgemäß.

Beispiele

Im folgenden Beispiel werden der AssemblyInstaller Konstruktor und die Install Methoden und Commit der AssemblyInstaller -Klasse veranschaulicht.

Eine AssemblyInstaller Klasse wird erstellt, indem der AssemblyInstaller Konstruktor aufgerufen wird. Die Eigenschaften dieses Objekts werden festgelegt, und die Install Methoden und 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 diesem instance erfolgreich sindInstallerCollection. Diese Methode ruft dann die Commit Methode jedes Installers in der Auflistung auf.

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

Gilt für: