AssemblyInstaller Costruttori

Definizione

Inizializza una nuova istanza della classe AssemblyInstaller.

Overload

AssemblyInstaller()

Inizializza una nuova istanza della classe AssemblyInstaller.

AssemblyInstaller(Assembly, String[])

Inizializza una nuova istanza della classe AssemblyInstaller e specifica sia l'assembly da installare, sia la riga di comando da utilizzare per la creazione di un nuovo oggetto InstallContext.

AssemblyInstaller(String, String[])

Inizializza una nuova istanza della classe AssemblyInstaller e specifica sia il nome file dell'assembly da installare, sia la riga di comando da utilizzare per la creazione di un nuovo oggetto InstallContext per l'installazione dell'assembly.

AssemblyInstaller()

Inizializza una nuova istanza della classe AssemblyInstaller.

public:
 AssemblyInstaller();
public AssemblyInstaller ();
Public Sub New ()

Esempio

Nell'esempio seguente vengono illustrati il AssemblyInstaller costruttore e i Install metodi e Commit della AssemblyInstaller classe .

Viene AssemblyInstaller creato 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

Si applica a

AssemblyInstaller(Assembly, String[])

Inizializza una nuova istanza della classe AssemblyInstaller e specifica sia l'assembly da installare, sia la riga di comando da utilizzare per la creazione di un nuovo oggetto InstallContext.

public:
 AssemblyInstaller(System::Reflection::Assembly ^ assembly, cli::array <System::String ^> ^ commandLine);
public AssemblyInstaller (System.Reflection.Assembly assembly, string[] commandLine);
new System.Configuration.Install.AssemblyInstaller : System.Reflection.Assembly * string[] -> System.Configuration.Install.AssemblyInstaller
Public Sub New (assembly As Assembly, commandLine As String())

Parametri

assembly
Assembly

Oggetto Assembly da installare.

commandLine
String[]

Riga di comando da utilizzare durante la creazione di un nuovo oggetto InstallContext per l'installazione dell'assembly. Può essere un valore Null.

Vedi anche

Si applica a

AssemblyInstaller(String, String[])

Inizializza una nuova istanza della classe AssemblyInstaller e specifica sia il nome file dell'assembly da installare, sia la riga di comando da utilizzare per la creazione di un nuovo oggetto InstallContext per l'installazione dell'assembly.

public:
 AssemblyInstaller(System::String ^ filename, cli::array <System::String ^> ^ commandLine);
public:
 AssemblyInstaller(System::String ^ fileName, cli::array <System::String ^> ^ commandLine);
public AssemblyInstaller (string filename, string[] commandLine);
public AssemblyInstaller (string fileName, string[] commandLine);
new System.Configuration.Install.AssemblyInstaller : string * string[] -> System.Configuration.Install.AssemblyInstaller
new System.Configuration.Install.AssemblyInstaller : string * string[] -> System.Configuration.Install.AssemblyInstaller
Public Sub New (filename As String, commandLine As String())
Public Sub New (fileName As String, commandLine As String())

Parametri

filenamefileName
String

Nome file dell'assembly da installare.

commandLine
String[]

Riga di comando da utilizzare durante la creazione di un nuovo oggetto InstallContext per l'installazione dell'assembly. Può essere un valore Null.

Esempio

Nell'esempio seguente viene creato un AssemblyInstaller oggetto richiamando il AssemblyInstaller costruttore con l'assembly da installare e la matrice di argomenti della riga di comando come parametri.

array<String^>^myStringArray = {"/logFile=example.log"};
String^ myString = "MyAssembly_Uninstall.exe";

// Create an object of the 'AssemblyInstaller' class.
AssemblyInstaller^ myAssemblyInstaller =
   gcnew AssemblyInstaller( myString,myStringArray );
string[] myStringArray = new string[ 1 ];
string myString;

// Set the commandline argument array for 'logfile'.
myStringArray[ 0 ] = "/logFile=example.log";

// Set the name of the assembly to install.
myString = "MyAssembly_Uninstall.exe";

// Create an object of the 'AssemblyInstaller' class.
AssemblyInstaller myAssemblyInstaller = new
         AssemblyInstaller( myString , myStringArray );
Dim myStringArray(0) As String
Dim myString As String


' Set the commandline argument array for 'logfile'.
myStringArray(0) = "/logFile=example.log"

' Set the name of the assembly to install.
myString = "MyAssembly_Uninstall.exe"

' Create an object of the 'AssemblyInstaller' class.
Dim myAssemblyInstaller As New AssemblyInstaller(myString, myStringArray)

Vedi anche

Si applica a