AssemblyInstaller.Commit(IDictionary) Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Completa la transazione di installazione.
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)
Parametri
- savedState
- IDictionary
Oggetto IDictionary contenente lo stato del computer dopo l'esecuzione di tutti i programmi di installazione nella raccolta del programma di installazione.
Eccezioni
Il savedState parametro è null.
oppure
Lo stato IDictionary salvato potrebbe essere danneggiato.
oppure
Impossibile trovare un file.
Si è verificato un errore nel Committing gestore eventi di uno dei programmi di installazione nella raccolta.
oppure
Si è verificato un errore nel Committed gestore eventi di uno dei programmi di installazione nella raccolta.
oppure
Si è verificata un'eccezione durante la Commit(IDictionary) fase dell'installazione. L'eccezione viene ignorata e l'installazione continua. Tuttavia, l'applicazione potrebbe non funzionare correttamente al termine dell'installazione.
oppure
I tipi di programma di installazione non sono stati trovati in uno degli assembly.
oppure
Impossibile creare un'istanza di uno dei tipi di programma di installazione.
Si è verificata un'eccezione durante la Commit(IDictionary) fase dell'installazione. L'eccezione viene ignorata e l'installazione continua. Tuttavia, l'applicazione potrebbe non funzionare correttamente al termine dell'installazione.
Esempio
Nell'esempio seguente viene illustrato il AssemblyInstaller costruttore e i Install metodi e Commit della AssemblyInstaller classe .
Una AssemblyInstaller classe viene creata richiamando il AssemblyInstaller costruttore. Le proprietà di questo oggetto vengono impostate e i Install metodi e Commit vengono chiamati per installare l'assembly 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
Commenti
Questo metodo viene chiamato solo se i Install metodi di tutti i programmi di installazione in questa istanza InstallerCollection hanno esito positivo. Questo metodo chiama quindi il Commit metodo di ogni programma di installazione nella raccolta.
Archiviare tutte le informazioni che potrebbe essere necessario eseguire un'operazione di disinstallazione corretta nello stato IDictionarysalvato , che viene passato al Uninstall metodo .