This documentation is archived and is not being maintained.

AssemblyInstaller Class

Loads an assembly, and runs all the installers in it.

For a list of all members of this type, see AssemblyInstaller Members.


[Visual Basic]
Public Class AssemblyInstaller
   Inherits Installer
public class AssemblyInstaller : Installer
public __gc class AssemblyInstaller : public Installer
public class AssemblyInstaller extends Installer

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


[Visual Basic, C#, C++] In the following example, an AssemblyInstaller is created by invoking the AssemblyInstaller constructor. The properties of this object are set and the Install and Commit methods are called to install the MyAssembly.exe assembly.

[Visual Basic] 
Imports System
Imports System.Configuration.Install
Imports System.Collections
Imports System.Collections.Specialized

Class AssemblyInstaller_Example

   Shared Sub Main()
      Dim mySavedState = New Hashtable()


         ' Set the commandline argument array for 'logfile'.
         Dim commandLineOptions(0) As String
         commandLineOptions(0) = "/LogFile=example.log"

         ' Create an object of the 'AssemblyInstaller' class.
         Dim myAssemblyInstaller As _
               New AssemblyInstaller("MyAssembly.exe", commandLineOptions)

         myAssemblyInstaller.UseNewContext = True

         ' Install the 'MyAssembly' assembly.

         ' Commit the 'MyAssembly' assembly.
      Catch e As ArgumentException
      Catch e As Exception
      End Try
   End Sub 'Main
End Class 'AssemblyInstaller_Example

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( "" );

         // 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 );

#using <mscorlib.dll>
#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;

int main() {
    IDictionary* mySavedState = new Hashtable();


    try {
        // Set the commandline argument array for 'logfile'.
        String* commandLineOptions[] = {S"/LogFile=example.log"};

        // Create an object of the 'AssemblyInstaller' class.
        AssemblyInstaller* myAssemblyInstaller = new AssemblyInstaller(S"MyAssembly.exe" , commandLineOptions);

        myAssemblyInstaller->UseNewContext = true;

        // Install the 'MyAssembly' assembly.

        // Commit the 'MyAssembly' assembly.
    } catch (ArgumentException*) {
    } catch (Exception* e) {

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Namespace: System.Configuration.Install

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System.Configuration.Install (in System.Configuration.Install.dll)

See Also

AssemblyInstaller Members | System.Configuration.Install Namespace