Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
1 out of 3 rated this helpful - Rate this topic

AssemblyInstaller Class

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

Namespace: System.Configuration.Install
Assembly: System.Configuration.Install (in system.configuration.install.dll)

public class AssemblyInstaller : Installer
public class AssemblyInstaller extends Installer
public class AssemblyInstaller extends Installer
Not applicable.

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.

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
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft. All rights reserved.