次の方法で共有


InstallerCollection.AddRange メソッド

指定したインストーラをコレクションに追加します。

オーバーロードの一覧

指定したインストーラ配列をコレクションに追加します。

[Visual Basic] Overloads Public Sub AddRange(Installer())

[C#] public void AddRange(Installer[]);

[C++] public: void AddRange(Installer*[]);

[JScript] public function AddRange(Installer[]);

コレクションに、指定したインストーラ コレクションを追加します。

[Visual Basic] Overloads Public Sub AddRange(InstallerCollection)

[C#] public void AddRange(InstallerCollection);

[C++] public: void AddRange(InstallerCollection*);

[JScript] public function AddRange(InstallerCollection);

使用例

[Visual Basic, C#, C++] InstallerCollection クラスの Insert メソッドと AddRange メソッドの例を次に示します。これは MyAssembly1.exe および MyAssembly2.exeAssemblyInstaller インスタンスを作成します。これらの AssemblyInstaller のインスタンスは、 myTransactedInstaller1 という名前の TransactedInstaller に追加されます。 myTransactedInstaller1 のインストーラは、 myTransactedInstaller2 という名前の別の TransactedInstaller にコピーされます。インストール プロセスによって、 MyAssembly1.exeMyAssembly2.exe の両方がインストールされます。

[Visual Basic, C#, C++] メモ   ここでは、AddRange のオーバーロード形式のうちの 1 つだけについて、使用例を示します。その他の例については、各オーバーロード形式のトピックを参照してください。

 
Dim myTransactedInstaller1 As New TransactedInstaller()
Dim myTransactedInstaller2 As New TransactedInstaller()
Dim myAssemblyInstaller As New AssemblyInstaller()
Dim myInstallContext As InstallContext

' Create a instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'.
myAssemblyInstaller = New AssemblyInstaller("MyAssembly1.exe", Nothing)

' 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", Nothing)

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

' Copy the installers of 'myTransactedInstaller1' to 'myTransactedInstaller2'.
myTransactedInstaller2.Installers.AddRange(myTransactedInstaller1.Installers)


[C#] 
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'.
myTransactedInstaller2.Installers.AddRange(myTransactedInstaller1.Installers);


[C++] 
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(S"MyAssembly1.exe", 0);

// 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(S"MyAssembly2.exe", 0);

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

// Copy the installers of 'myTransactedInstaller1' to 'myTransactedInstaller2'.
myTransactedInstaller2->Installers->AddRange(myTransactedInstaller1->Installers);

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

参照

InstallerCollection クラス | InstallerCollection メンバ | System.Configuration.Install 名前空間