AppDomain.ExecuteAssembly メソッド

定義

指定したファイルに格納されているアセンブリを実行します。

オーバーロード

ExecuteAssembly(String, Evidence, String[], Byte[], AssemblyHashAlgorithm)
古い.

指定したファイルに格納されているアセンブリを、指定した証拠、引数、ハッシュ値、およびハッシュ アルゴリズムを使用して実行します。

ExecuteAssembly(String, Evidence, String[])
古い.

指定したファイルに格納されているアセンブリを、指定した証拠と引数を使用して実行します。

ExecuteAssembly(String, String[], Byte[], AssemblyHashAlgorithm)
古い.

指定したファイルに格納されているアセンブリを、指定した引数、ハッシュ値、およびハッシュ アルゴリズムを使用して実行します。

ExecuteAssembly(String, Evidence)
古い.

指定したファイルに格納されているアセンブリを、指定した証拠を使用して実行します。

ExecuteAssembly(String, String[])

指定したファイルに格納されているアセンブリを、指定した引数を使用して実行します。

ExecuteAssembly(String)

指定したファイルに格納されているアセンブリを実行します。

ExecuteAssembly(String, Evidence, String[], Byte[], AssemblyHashAlgorithm)

注意事項

Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of ExecuteAssembly which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.

指定したファイルに格納されているアセンブリを、指定した証拠、引数、ハッシュ値、およびハッシュ アルゴリズムを使用して実行します。

public:
 int ExecuteAssembly(System::String ^ assemblyFile, System::Security::Policy::Evidence ^ assemblySecurity, cli::array <System::String ^> ^ args, cli::array <System::Byte> ^ hashValue, System::Configuration::Assemblies::AssemblyHashAlgorithm hashAlgorithm);
public int ExecuteAssembly (string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[] args, byte[] hashValue, System.Configuration.Assemblies.AssemblyHashAlgorithm hashAlgorithm);
[System.Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of ExecuteAssembly which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
public int ExecuteAssembly (string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[] args, byte[] hashValue, System.Configuration.Assemblies.AssemblyHashAlgorithm hashAlgorithm);
member this.ExecuteAssembly : string * System.Security.Policy.Evidence * string[] * byte[] * System.Configuration.Assemblies.AssemblyHashAlgorithm -> int
[<System.Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of ExecuteAssembly which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")>]
member this.ExecuteAssembly : string * System.Security.Policy.Evidence * string[] * byte[] * System.Configuration.Assemblies.AssemblyHashAlgorithm -> int
Public Function ExecuteAssembly (assemblyFile As String, assemblySecurity As Evidence, args As String(), hashValue As Byte(), hashAlgorithm As AssemblyHashAlgorithm) As Integer

パラメーター

assemblyFile
String

実行するアセンブリが格納されているファイルの名前。

assemblySecurity
Evidence

アセンブリに指定する証拠。

args
String[]

アセンブリのエントリ ポイントに渡す引数。

hashValue
Byte[]

計算されたハッシュ コードの値を表します。

hashAlgorithm
AssemblyHashAlgorithm

アセンブリ マニフェストが使用するハッシュ アルゴリズムを表します。

戻り値

アセンブリのエントリ ポイントが返す値。

属性

例外

assemblyFilenullです。

assemblyFile が見つかりません。

assemblyFile は、現在読み込まれているランタイムの有効なアセンブリではありません。

アンロードされたアプリケーション ドメインで操作しようとします。

アセンブリまたはモジュールが、2 つの異なる証拠を使用して 2 回読み込まれました。

assemblySecuritynull ではありません。 レガシ CAS ポリシーが有効でない場合は、assemblySecuritynull にする必要があります。

指定したアセンブリには、エントリ ポイントがありません。

次の例では、2 つの異なるドメインで のオーバーロード ExecuteAssembly の 1 つを使用する方法を示します。

int main()
{
   AppDomain^ currentDomain = AppDomain::CurrentDomain;
   AppDomain^ otherDomain = AppDomain::CreateDomain( "otherDomain" );
   currentDomain->ExecuteAssembly( "MyExecutable.exe" );
   
   // Prints S"MyExecutable running on [default]"
   otherDomain->ExecuteAssembly( "MyExecutable.exe" );
   
   // Prints S"MyExecutable running on otherDomain"
}
class ExecuteAssemblySnippet {
   public static void Main() {
      AppDomain currentDomain = AppDomain.CurrentDomain;
      AppDomain otherDomain = AppDomain.CreateDomain("otherDomain");

      currentDomain.ExecuteAssembly("MyExecutable.exe");
      // Prints "MyExecutable running on [default]"

      otherDomain.ExecuteAssembly("MyExecutable.exe");
      // Prints "MyExecutable running on otherDomain"
   }
}
open System

let currentDomain = AppDomain.CurrentDomain
let otherDomain = AppDomain.CreateDomain "otherDomain"

currentDomain.ExecuteAssembly "MyExecutable.exe"
// Prints "MyExecutable running on [default]"

otherDomain.ExecuteAssembly "MyExecutable.exe"
// Prints "MyExecutable running on otherDomain"
Module Test

   Sub Main()
      Dim currentDomain As AppDomain = AppDomain.CurrentDomain
      Dim otherDomain As AppDomain = AppDomain.CreateDomain("otherDomain")
      
      currentDomain.ExecuteAssembly("MyExecutable.exe")
      ' Prints "MyExecutable running on [default]"

      otherDomain.ExecuteAssembly("MyExecutable.exe")
      ' Prints "MyExecutable running on otherDomain"
   End Sub

End Module 'Test

注釈

アセンブリは、.NET Framework ヘッダーで指定されたエントリ ポイントで実行を開始します。

このメソッドは、新しいプロセスまたはアプリケーション ドメインを作成せず、新しいスレッドでエントリ ポイント メソッドを実行しません。

このメソッドは、 メソッドを使用してアセンブリを LoadFile 読み込みます。 メソッドを使用してアセンブリを ExecuteAssemblyByName 実行することもできます。このメソッドは、 メソッドを使用してアセンブリを Load 読み込みます。

適用対象

ExecuteAssembly(String, Evidence, String[])

注意事項

Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of ExecuteAssembly which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.

指定したファイルに格納されているアセンブリを、指定した証拠と引数を使用して実行します。

public:
 virtual int ExecuteAssembly(System::String ^ assemblyFile, System::Security::Policy::Evidence ^ assemblySecurity, cli::array <System::String ^> ^ args);
public int ExecuteAssembly (string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[] args);
[System.Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of ExecuteAssembly which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
public int ExecuteAssembly (string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[] args);
abstract member ExecuteAssembly : string * System.Security.Policy.Evidence * string[] -> int
override this.ExecuteAssembly : string * System.Security.Policy.Evidence * string[] -> int
[<System.Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of ExecuteAssembly which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")>]
abstract member ExecuteAssembly : string * System.Security.Policy.Evidence * string[] -> int
override this.ExecuteAssembly : string * System.Security.Policy.Evidence * string[] -> int
Public Function ExecuteAssembly (assemblyFile As String, assemblySecurity As Evidence, args As String()) As Integer

パラメーター

assemblyFile
String

実行するアセンブリが格納されているファイルの名前。

assemblySecurity
Evidence

アセンブリに指定する証拠。

args
String[]

アセンブリのエントリ ポイントに渡す引数。

戻り値

アセンブリのエントリ ポイントが返す値。

実装

属性

例外

assemblyFilenullです。

assemblyFile が見つかりません。

assemblyFile は、現在読み込まれているランタイムの有効なアセンブリではありません。

アンロードされたアプリケーション ドメインで操作しようとします。

アセンブリまたはモジュールが、2 つの異なる証拠を使用して 2 回読み込まれました。

assemblySecuritynull ではありません。 レガシ CAS ポリシーが有効でない場合は、assemblySecuritynull にする必要があります。

指定したアセンブリには、エントリ ポイントがありません。

次の例では、2 つの異なるドメインで のオーバーロード ExecuteAssembly の 1 つを使用する方法を示します。

int main()
{
   AppDomain^ currentDomain = AppDomain::CurrentDomain;
   AppDomain^ otherDomain = AppDomain::CreateDomain( "otherDomain" );
   currentDomain->ExecuteAssembly( "MyExecutable.exe" );
   
   // Prints S"MyExecutable running on [default]"
   otherDomain->ExecuteAssembly( "MyExecutable.exe" );
   
   // Prints S"MyExecutable running on otherDomain"
}
class ExecuteAssemblySnippet {
   public static void Main() {
      AppDomain currentDomain = AppDomain.CurrentDomain;
      AppDomain otherDomain = AppDomain.CreateDomain("otherDomain");

      currentDomain.ExecuteAssembly("MyExecutable.exe");
      // Prints "MyExecutable running on [default]"

      otherDomain.ExecuteAssembly("MyExecutable.exe");
      // Prints "MyExecutable running on otherDomain"
   }
}
open System

let currentDomain = AppDomain.CurrentDomain
let otherDomain = AppDomain.CreateDomain "otherDomain"

currentDomain.ExecuteAssembly "MyExecutable.exe"
// Prints "MyExecutable running on [default]"

otherDomain.ExecuteAssembly "MyExecutable.exe"
// Prints "MyExecutable running on otherDomain"
Module Test

   Sub Main()
      Dim currentDomain As AppDomain = AppDomain.CurrentDomain
      Dim otherDomain As AppDomain = AppDomain.CreateDomain("otherDomain")
      
      currentDomain.ExecuteAssembly("MyExecutable.exe")
      ' Prints "MyExecutable running on [default]"

      otherDomain.ExecuteAssembly("MyExecutable.exe")
      ' Prints "MyExecutable running on otherDomain"
   End Sub

End Module 'Test

注釈

アセンブリは、.NET Framework ヘッダーで指定されたエントリ ポイントで実行を開始します。

このメソッドは、新しいプロセスまたはアプリケーション ドメインを作成せず、新しいスレッドでエントリ ポイント メソッドを実行しません。

このメソッドは、 メソッドを使用してアセンブリを LoadFile 読み込みます。 メソッドを使用してアセンブリを ExecuteAssemblyByName 実行することもできます。このメソッドは、 メソッドを使用してアセンブリを Load 読み込みます。

適用対象

ExecuteAssembly(String, String[], Byte[], AssemblyHashAlgorithm)

Source:
AppDomain.cs
Source:
AppDomain.cs
Source:
AppDomain.cs

注意事項

Code Access Security is not supported or honored by the runtime.

指定したファイルに格納されているアセンブリを、指定した引数、ハッシュ値、およびハッシュ アルゴリズムを使用して実行します。

public:
 int ExecuteAssembly(System::String ^ assemblyFile, cli::array <System::String ^> ^ args, cli::array <System::Byte> ^ hashValue, System::Configuration::Assemblies::AssemblyHashAlgorithm hashAlgorithm);
public int ExecuteAssembly (string assemblyFile, string?[]? args, byte[]? hashValue, System.Configuration.Assemblies.AssemblyHashAlgorithm hashAlgorithm);
[System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public int ExecuteAssembly (string assemblyFile, string?[]? args, byte[]? hashValue, System.Configuration.Assemblies.AssemblyHashAlgorithm hashAlgorithm);
public int ExecuteAssembly (string assemblyFile, string[] args, byte[] hashValue, System.Configuration.Assemblies.AssemblyHashAlgorithm hashAlgorithm);
member this.ExecuteAssembly : string * string[] * byte[] * System.Configuration.Assemblies.AssemblyHashAlgorithm -> int
[<System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.ExecuteAssembly : string * string[] * byte[] * System.Configuration.Assemblies.AssemblyHashAlgorithm -> int
Public Function ExecuteAssembly (assemblyFile As String, args As String(), hashValue As Byte(), hashAlgorithm As AssemblyHashAlgorithm) As Integer

パラメーター

assemblyFile
String

実行するアセンブリが格納されているファイルの名前。

args
String[]

アセンブリのエントリ ポイントに渡す引数。

hashValue
Byte[]

計算されたハッシュ コードの値を表します。

hashAlgorithm
AssemblyHashAlgorithm

アセンブリ マニフェストが使用するハッシュ アルゴリズムを表します。

戻り値

アセンブリのエントリ ポイントから返された値。

属性

例外

assemblyFilenullです。

assemblyFile が見つかりません。

assemblyFile は、現在読み込まれているランタイムの有効なアセンブリではありません。

アンロードされたアプリケーション ドメインで操作しようとします。

アセンブリまたはモジュールが、2 つの異なる証拠を使用して 2 回読み込まれました。

指定したアセンブリには、エントリ ポイントがありません。

次の例では、2 つの異なるドメインで のオーバーロード ExecuteAssembly の 1 つを使用する方法を示します。

int main()
{
   AppDomain^ currentDomain = AppDomain::CurrentDomain;
   AppDomain^ otherDomain = AppDomain::CreateDomain( "otherDomain" );
   currentDomain->ExecuteAssembly( "MyExecutable.exe" );
   
   // Prints S"MyExecutable running on [default]"
   otherDomain->ExecuteAssembly( "MyExecutable.exe" );
   
   // Prints S"MyExecutable running on otherDomain"
}
class ExecuteAssemblySnippet {
   public static void Main() {
      AppDomain currentDomain = AppDomain.CurrentDomain;
      AppDomain otherDomain = AppDomain.CreateDomain("otherDomain");

      currentDomain.ExecuteAssembly("MyExecutable.exe");
      // Prints "MyExecutable running on [default]"

      otherDomain.ExecuteAssembly("MyExecutable.exe");
      // Prints "MyExecutable running on otherDomain"
   }
}
open System

let currentDomain = AppDomain.CurrentDomain
let otherDomain = AppDomain.CreateDomain "otherDomain"

currentDomain.ExecuteAssembly "MyExecutable.exe"
// Prints "MyExecutable running on [default]"

otherDomain.ExecuteAssembly "MyExecutable.exe"
// Prints "MyExecutable running on otherDomain"
Module Test

   Sub Main()
      Dim currentDomain As AppDomain = AppDomain.CurrentDomain
      Dim otherDomain As AppDomain = AppDomain.CreateDomain("otherDomain")
      
      currentDomain.ExecuteAssembly("MyExecutable.exe")
      ' Prints "MyExecutable running on [default]"

      otherDomain.ExecuteAssembly("MyExecutable.exe")
      ' Prints "MyExecutable running on otherDomain"
   End Sub

End Module 'Test

注釈

注意事項

コード アクセス セキュリティ (CAS) は、.NET Framework と .NET のすべてのバージョンで非推奨になりました。 最近のバージョンの .NET では、CAS 関連の API が使われている場合、CAS の注釈は使われず、エラーが発生します。 開発者は、代わりの手段を見つけてセキュリティ タスクを実現する必要があります。

アセンブリは、.NET Framework ヘッダーで指定されたエントリ ポイントで実行を開始します。

このメソッドは、新しいプロセスまたはアプリケーション ドメインを作成せず、新しいスレッドでエントリ ポイント メソッドを実行しません。

このメソッドは、 メソッドを使用してアセンブリを LoadFile 読み込みます。 メソッドを使用してアセンブリを ExecuteAssemblyByName 実行することもできます。このメソッドは、 メソッドを使用してアセンブリを Load 読み込みます。

適用対象

ExecuteAssembly(String, Evidence)

注意事項

Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of ExecuteAssembly which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.

指定したファイルに格納されているアセンブリを、指定した証拠を使用して実行します。

public:
 virtual int ExecuteAssembly(System::String ^ assemblyFile, System::Security::Policy::Evidence ^ assemblySecurity);
public int ExecuteAssembly (string assemblyFile, System.Security.Policy.Evidence assemblySecurity);
[System.Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of ExecuteAssembly which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
public int ExecuteAssembly (string assemblyFile, System.Security.Policy.Evidence assemblySecurity);
abstract member ExecuteAssembly : string * System.Security.Policy.Evidence -> int
override this.ExecuteAssembly : string * System.Security.Policy.Evidence -> int
[<System.Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of ExecuteAssembly which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")>]
abstract member ExecuteAssembly : string * System.Security.Policy.Evidence -> int
override this.ExecuteAssembly : string * System.Security.Policy.Evidence -> int
Public Function ExecuteAssembly (assemblyFile As String, assemblySecurity As Evidence) As Integer

パラメーター

assemblyFile
String

実行するアセンブリが格納されているファイルの名前。

assemblySecurity
Evidence

アセンブリを読み込むために必要な証拠。

戻り値

アセンブリのエントリ ポイントが返す値。

実装

属性

例外

assemblyFilenullです。

assemblyFile が見つかりません。

assemblyFile は、現在読み込まれているランタイムの有効なアセンブリではありません。

アンロードされたアプリケーション ドメインで操作しようとします。

アセンブリまたはモジュールが、2 つの異なる証拠を使用して 2 回読み込まれました。

指定したアセンブリには、エントリ ポイントがありません。

次の例では、2 つの異なるドメインで のオーバーロード ExecuteAssembly の 1 つを使用する方法を示します。

int main()
{
   AppDomain^ currentDomain = AppDomain::CurrentDomain;
   AppDomain^ otherDomain = AppDomain::CreateDomain( "otherDomain" );
   currentDomain->ExecuteAssembly( "MyExecutable.exe" );
   
   // Prints S"MyExecutable running on [default]"
   otherDomain->ExecuteAssembly( "MyExecutable.exe" );
   
   // Prints S"MyExecutable running on otherDomain"
}
class ExecuteAssemblySnippet {
   public static void Main() {
      AppDomain currentDomain = AppDomain.CurrentDomain;
      AppDomain otherDomain = AppDomain.CreateDomain("otherDomain");

      currentDomain.ExecuteAssembly("MyExecutable.exe");
      // Prints "MyExecutable running on [default]"

      otherDomain.ExecuteAssembly("MyExecutable.exe");
      // Prints "MyExecutable running on otherDomain"
   }
}
open System

let currentDomain = AppDomain.CurrentDomain
let otherDomain = AppDomain.CreateDomain "otherDomain"

currentDomain.ExecuteAssembly "MyExecutable.exe"
// Prints "MyExecutable running on [default]"

otherDomain.ExecuteAssembly "MyExecutable.exe"
// Prints "MyExecutable running on otherDomain"
Module Test

   Sub Main()
      Dim currentDomain As AppDomain = AppDomain.CurrentDomain
      Dim otherDomain As AppDomain = AppDomain.CreateDomain("otherDomain")
      
      currentDomain.ExecuteAssembly("MyExecutable.exe")
      ' Prints "MyExecutable running on [default]"

      otherDomain.ExecuteAssembly("MyExecutable.exe")
      ' Prints "MyExecutable running on otherDomain"
   End Sub

End Module 'Test

注釈

アセンブリは、.NET Framework ヘッダーで指定されたエントリ ポイントで実行を開始します。

メソッドは ExecuteAssembly 、新しいプロセスまたはアプリケーション ドメインを作成せず、新しいスレッドでエントリ ポイント メソッドを実行しません。

このメソッドは、 メソッドを使用してアセンブリを LoadFile 読み込みます。 メソッドを使用してアセンブリを ExecuteAssemblyByName 実行することもできます。このメソッドは、 メソッドを使用してアセンブリを Load 読み込みます。

適用対象

ExecuteAssembly(String, String[])

Source:
AppDomain.cs
Source:
AppDomain.cs
Source:
AppDomain.cs

指定したファイルに格納されているアセンブリを、指定した引数を使用して実行します。

public:
 int ExecuteAssembly(System::String ^ assemblyFile, cli::array <System::String ^> ^ args);
public int ExecuteAssembly (string assemblyFile, string?[]? args);
public int ExecuteAssembly (string assemblyFile, string[] args);
member this.ExecuteAssembly : string * string[] -> int
Public Function ExecuteAssembly (assemblyFile As String, args As String()) As Integer

パラメーター

assemblyFile
String

実行するアセンブリが格納されているファイルの名前。

args
String[]

アセンブリのエントリ ポイントに渡す引数。

戻り値

アセンブリのエントリ ポイントから返された値。

例外

assemblyFilenullです。

assemblyFile が見つかりません。

assemblyFile は、現在読み込まれているランタイムの有効なアセンブリではありません。

アンロードされたアプリケーション ドメインで操作しようとします。

アセンブリまたはモジュールが、2 つの異なる証拠を使用して 2 回読み込まれました。

指定したアセンブリには、エントリ ポイントがありません。

次の例では、2 つの異なるドメインで のオーバーロード ExecuteAssembly の 1 つを使用する方法を示します。

int main()
{
   AppDomain^ currentDomain = AppDomain::CurrentDomain;
   AppDomain^ otherDomain = AppDomain::CreateDomain( "otherDomain" );
   currentDomain->ExecuteAssembly( "MyExecutable.exe" );
   
   // Prints S"MyExecutable running on [default]"
   otherDomain->ExecuteAssembly( "MyExecutable.exe" );
   
   // Prints S"MyExecutable running on otherDomain"
}
class ExecuteAssemblySnippet {
   public static void Main() {
      AppDomain currentDomain = AppDomain.CurrentDomain;
      AppDomain otherDomain = AppDomain.CreateDomain("otherDomain");

      currentDomain.ExecuteAssembly("MyExecutable.exe");
      // Prints "MyExecutable running on [default]"

      otherDomain.ExecuteAssembly("MyExecutable.exe");
      // Prints "MyExecutable running on otherDomain"
   }
}
open System

let currentDomain = AppDomain.CurrentDomain
let otherDomain = AppDomain.CreateDomain "otherDomain"

currentDomain.ExecuteAssembly "MyExecutable.exe"
// Prints "MyExecutable running on [default]"

otherDomain.ExecuteAssembly "MyExecutable.exe"
// Prints "MyExecutable running on otherDomain"
Module Test

   Sub Main()
      Dim currentDomain As AppDomain = AppDomain.CurrentDomain
      Dim otherDomain As AppDomain = AppDomain.CreateDomain("otherDomain")
      
      currentDomain.ExecuteAssembly("MyExecutable.exe")
      ' Prints "MyExecutable running on [default]"

      otherDomain.ExecuteAssembly("MyExecutable.exe")
      ' Prints "MyExecutable running on otherDomain"
   End Sub

End Module 'Test

注釈

アセンブリは、.NET Framework ヘッダーで指定されたエントリ ポイントで実行を開始します。

このメソッドは、新しいプロセスまたはアプリケーション ドメインを作成せず、新しいスレッドでエントリ ポイント メソッドを実行しません。

このメソッドは、 メソッドを使用してアセンブリを LoadFile 読み込みます。 メソッドを使用してアセンブリを ExecuteAssemblyByName 実行することもできます。このメソッドは、 メソッドを使用してアセンブリを Load 読み込みます。

適用対象

ExecuteAssembly(String)

Source:
AppDomain.cs
Source:
AppDomain.cs
Source:
AppDomain.cs

指定したファイルに格納されているアセンブリを実行します。

public:
 int ExecuteAssembly(System::String ^ assemblyFile);
public:
 virtual int ExecuteAssembly(System::String ^ assemblyFile);
public int ExecuteAssembly (string assemblyFile);
member this.ExecuteAssembly : string -> int
abstract member ExecuteAssembly : string -> int
override this.ExecuteAssembly : string -> int
Public Function ExecuteAssembly (assemblyFile As String) As Integer

パラメーター

assemblyFile
String

実行するアセンブリが格納されているファイルの名前。

戻り値

アセンブリのエントリ ポイントが返す値。

実装

例外

assemblyFilenullです。

assemblyFile が見つかりません。

assemblyFile は、現在読み込まれているランタイムの有効なアセンブリではありません。

アンロードされたアプリケーション ドメインで操作しようとします。

アセンブリまたはモジュールが、2 つの異なる証拠を使用して 2 回読み込まれました。

指定したアセンブリには、エントリ ポイントがありません。

次の例では、2 つの異なるドメインで のオーバーロード ExecuteAssembly の 1 つを使用する方法を示します。

int main()
{
   AppDomain^ currentDomain = AppDomain::CurrentDomain;
   AppDomain^ otherDomain = AppDomain::CreateDomain( "otherDomain" );
   currentDomain->ExecuteAssembly( "MyExecutable.exe" );
   
   // Prints S"MyExecutable running on [default]"
   otherDomain->ExecuteAssembly( "MyExecutable.exe" );
   
   // Prints S"MyExecutable running on otherDomain"
}
class ExecuteAssemblySnippet {
   public static void Main() {
      AppDomain currentDomain = AppDomain.CurrentDomain;
      AppDomain otherDomain = AppDomain.CreateDomain("otherDomain");

      currentDomain.ExecuteAssembly("MyExecutable.exe");
      // Prints "MyExecutable running on [default]"

      otherDomain.ExecuteAssembly("MyExecutable.exe");
      // Prints "MyExecutable running on otherDomain"
   }
}
open System

let currentDomain = AppDomain.CurrentDomain
let otherDomain = AppDomain.CreateDomain "otherDomain"

currentDomain.ExecuteAssembly "MyExecutable.exe"
// Prints "MyExecutable running on [default]"

otherDomain.ExecuteAssembly "MyExecutable.exe"
// Prints "MyExecutable running on otherDomain"
Module Test

   Sub Main()
      Dim currentDomain As AppDomain = AppDomain.CurrentDomain
      Dim otherDomain As AppDomain = AppDomain.CreateDomain("otherDomain")
      
      currentDomain.ExecuteAssembly("MyExecutable.exe")
      ' Prints "MyExecutable running on [default]"

      otherDomain.ExecuteAssembly("MyExecutable.exe")
      ' Prints "MyExecutable running on otherDomain"
   End Sub

End Module 'Test

注釈

アセンブリは、.NET Framework ヘッダーで指定されたエントリ ポイントで実行を開始します。

このメソッドは、新しいプロセスまたはアプリケーション ドメインを作成せず、新しいスレッドでエントリ ポイント メソッドを実行しません。

このメソッドは、 メソッドを使用してアセンブリを LoadFile 読み込みます。 メソッドを使用してアセンブリを ExecuteAssemblyByName 実行することもできます。このメソッドは、 メソッドを使用してアセンブリを Load 読み込みます。

読み込んで実行する を AppDomain 作成するには、 メソッドを使用します CreateDomain

適用対象