AssemblyInstaller.Commit(IDictionary) Methode

Definitie

Hiermee voltooit u de installatietransactie.

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)

Parameters

savedState
IDictionary

Een IDictionary die de status van de computer bevat nadat alle installatieprogramma's in de installatieverzameling zijn uitgevoerd.

Uitzonderingen

De savedState parameter is null.

– of –

De opgeslagen status IDictionary is mogelijk beschadigd.

– of –

Er is geen bestand gevonden.

Er is een fout opgetreden in de Committing gebeurtenis-handler van een van de installatieprogramma's in de verzameling.

– of –

Er is een fout opgetreden in de Committed gebeurtenis-handler van een van de installatieprogramma's in de verzameling.

– of –

Er is een uitzondering opgetreden tijdens de Commit(IDictionary) fase van de installatie. De uitzondering wordt genegeerd en de installatie wordt voortgezet. De toepassing werkt echter mogelijk niet correct nadat de installatie is voltooid.

– of –

Installatieprogrammatypen zijn niet gevonden in een van de assembly's.

– of –

Er kan geen exemplaar van een van de installatietypen worden gemaakt.

Er is een uitzondering opgetreden tijdens de Commit(IDictionary) fase van de installatie. De uitzondering wordt genegeerd en de installatie wordt voortgezet. De toepassing werkt echter mogelijk niet correct nadat de installatie is voltooid.

Voorbeelden

In het volgende voorbeeld ziet u de AssemblyInstaller constructor en de Install methoden Commit van de AssemblyInstaller klasse.

Er wordt een AssemblyInstaller klasse gemaakt door de AssemblyInstaller constructor aan te roepen. De eigenschappen van dit object worden ingesteld en de Install methoden Commit worden aangeroepen om de MyAssembly_Install.exe assembly te installeren.

#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

Opmerkingen

Deze methode wordt alleen aangeroepen als de Install methoden van alle installatieprogramma's in dit exemplaar InstallerCollection slagen. Met deze methode wordt vervolgens de Commit methode aangeroepen van elk installatieprogramma in de verzameling.

Sla alle gegevens op die u mogelijk nodig hebt om een juiste verwijderingsbewerking uit te voeren in de opgeslagen status IDictionary, die wordt doorgegeven aan de Uninstall methode.

Van toepassing op