InstallerCollection.AddRange Method (InstallerCollection)


Adds the specified collection of installers to this collection.

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

public void AddRange(
	InstallerCollection value


Type: System.Configuration.Install.InstallerCollection

An InstallerCollection that represents the installers to add to this collection.

The Parent property of each added Installer is set to the Installer containing this collection.

The following example demonstrates the Insert method and the AddRange methods of the InstallerCollection class. It creates AssemblyInstaller instances for MyAssembly1.exe and MyAssembly2.exe. These instances of AssemblyInstaller are added to a TransactedInstaller named myTransactedInstaller1. The installers in the myTransactedInstaller1 are copied to another TransactedInstaller named myTransactedInstaller2. The installation process installs both MyAssembly1.exe and MyAssembly2.exe.

TransactedInstaller myTransactedInstaller1 = new TransactedInstaller();
TransactedInstaller myTransactedInstaller2 = new TransactedInstaller();
AssemblyInstaller myAssemblyInstaller = new AssemblyInstaller();
InstallContext myInstallContext;

// Create a instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'.
myAssemblyInstaller = 
   new AssemblyInstaller("MyAssembly1.exe", null);

// Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'.
myTransactedInstaller1.Installers.Insert(0, myAssemblyInstaller);

// Create a instance of 'AssemblyInstaller' that installs 'MyAssembly2.exe'.
myAssemblyInstaller = 
   new AssemblyInstaller("MyAssembly2.exe", null);

// Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'.
myTransactedInstaller1.Installers.Insert(1, myAssemblyInstaller);

// Copy the installers of 'myTransactedInstaller1' to 'myTransactedInstaller2'.

.NET Framework
Available since 1.1
Return to top