AssemblyInstaller (Clase)
Carga un ensamblado y ejecuta todos los instaladores que contiene.
Espacio de nombres: System.Configuration.Install
Ensamblado: System.Configuration.Install (en system.configuration.install.dll)
Ensamblado: System.Configuration.Install (en system.configuration.install.dll)
En el siguiente ejemplo, se crea AssemblyInstaller mediante una llamada al constructor AssemblyInstaller. Se establecen las propiedades de este objeto y se llama a los métodos Install y Commit para que instalen el ensamblado MyAssembly.exe.
using System; using System.Configuration.Install; using System.Collections; using System.Collections.Specialized; class AssemblyInstaller_Example { static void Main() { IDictionary mySavedState = new Hashtable(); Console.WriteLine( "" ); try { // Set the commandline argument array for 'logfile'. string[] commandLineOptions = new string[ 1 ] {"/LogFile=example.log"}; // Create an object of the 'AssemblyInstaller' class. AssemblyInstaller myAssemblyInstaller = new AssemblyInstaller( "MyAssembly.exe" , commandLineOptions ); myAssemblyInstaller.UseNewContext = true; // Install the 'MyAssembly' assembly. myAssemblyInstaller.Install( mySavedState ); // Commit the 'MyAssembly' assembly. myAssemblyInstaller.Commit( mySavedState ); } catch (ArgumentException) { } catch (Exception e) { Console.WriteLine( e.Message ); } } }
import System.*;
import System.Configuration.Install.*;
import System.Collections.*;
import System.Collections.Specialized.*;
class AssemblyInstallerExample
{
public static void main(String[] args)
{
IDictionary mySavedState = new Hashtable();
Console.WriteLine("");
try {
// Set the commandline argument array for 'logfile'.
String commandLineOptions[] =
new String[] { "/LogFile=example.log" };
// Create an object of the 'AssemblyInstaller' class.
AssemblyInstaller myAssemblyInstaller =
new AssemblyInstaller("MyAssembly.exe", commandLineOptions);
myAssemblyInstaller.set_UseNewContext(true);
// Install the 'MyAssembly' assembly.
myAssemblyInstaller.Install(mySavedState);
// Commit the 'MyAssembly' assembly.
myAssemblyInstaller.Commit(mySavedState);
}
catch (ArgumentException exp) {
}
catch (System.Exception e) {
Console.WriteLine(e.get_Message());
}
} //main
} //AssemblyInstallerExample
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Configuration.Install.Installer
System.Configuration.Install.AssemblyInstaller
System.MarshalByRefObject
System.ComponentModel.Component
System.Configuration.Install.Installer
System.Configuration.Install.AssemblyInstaller
Windows 98, Windows 2000 SP4, Windows Millennium, Windows Server 2003, Windows XP Media Center, Windows XP Professional x64, Windows XP SP2, Windows XP Starter Edition
.NET Framework no admite todas las versiones de cada plataforma. Para obtener una lista de las versiones admitidas, vea Requisitos del sistema.
Contenido de la comunidad
Agregar