AppDomain.ExecuteAssemblyとは? わかりやすく解説

AppDomain.ExecuteAssembly メソッド (String, Evidence, String[])

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

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Function ExecuteAssembly ( _
    assemblyFile As String, _
    assemblySecurity As Evidence, _
    args As String() _
) As Integer
Dim instance As AppDomain
Dim assemblyFile As String
Dim assemblySecurity As Evidence
Dim args As String()
Dim returnValue As Integer

returnValue = instance.ExecuteAssembly(assemblyFile, assemblySecurity, args)
public int ExecuteAssembly (
    string assemblyFile,
    Evidence assemblySecurity,
    string[] args
)
public:
virtual int ExecuteAssembly (
    String^ assemblyFile, 
    Evidence^ assemblySecurity, 
    array<String^>^ args
) sealed
public final int ExecuteAssembly (
    String assemblyFile, 
    Evidence assemblySecurity, 
    String[] args
)
public final function ExecuteAssembly (
    assemblyFile : String, 
    assemblySecurity : Evidence, 
    args : String[]
) : int

パラメータ

assemblyFile

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

assemblySecurity

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

args

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

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

例外例外
例外の種類条件

ArgumentNullException

assemblyFile が null 参照 (Visual Basic では Nothing) です。

FileNotFoundException

assemblyFile が見つかりません。

BadImageFormatException

assemblyFile が有効なアセンブリではありません。

AppDomainUnloadedException

操作が、アンロードされたアプリケーション ドメインで試行されています。

FileLoadException

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

解説解説
使用例使用例

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

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 'Main

End Module 'Test
class Test {
   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"
   }
}
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"
}

.NET Framework のセキュリティ.NET Framework のセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

AppDomain.ExecuteAssembly メソッド (String)

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

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Function ExecuteAssembly ( _
    assemblyFile As String _
) As Integer
Dim instance As AppDomain
Dim assemblyFile As String
Dim returnValue As Integer

returnValue = instance.ExecuteAssembly(assemblyFile)
public int ExecuteAssembly (
    string assemblyFile
)
public:
virtual int ExecuteAssembly (
    String^ assemblyFile
) sealed
public final int ExecuteAssembly (
    String assemblyFile
)
public final function ExecuteAssembly (
    assemblyFile : String
) : int

パラメータ

assemblyFile

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

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

例外例外
例外の種類条件

ArgumentNullException

assemblyFile が null 参照 (Visual Basic では Nothing) です。

FileNotFoundException

assemblyFile が見つかりません。

BadImageFormatException

assemblyFile が有効なアセンブリではありません。

AppDomainUnloadedException

操作が、アンロードされたアプリケーション ドメインで試行されています。

FileLoadException

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

解説解説
使用例使用例

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

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 'Main

End Module 'Test
class Test {
   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"
   }
}
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"
}

.NET Framework のセキュリティ.NET Framework のセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

AppDomain.ExecuteAssembly メソッド


AppDomain.ExecuteAssembly メソッド (String, Evidence)

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

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Function ExecuteAssembly ( _
    assemblyFile As String, _
    assemblySecurity As Evidence _
) As Integer
Dim instance As AppDomain
Dim assemblyFile As String
Dim assemblySecurity As Evidence
Dim returnValue As Integer

returnValue = instance.ExecuteAssembly(assemblyFile, assemblySecurity)
public int ExecuteAssembly (
    string assemblyFile,
    Evidence assemblySecurity
)
public:
virtual int ExecuteAssembly (
    String^ assemblyFile, 
    Evidence^ assemblySecurity
) sealed
public final int ExecuteAssembly (
    String assemblyFile, 
    Evidence assemblySecurity
)
public final function ExecuteAssembly (
    assemblyFile : String, 
    assemblySecurity : Evidence
) : int

パラメータ

assemblyFile

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

assemblySecurity

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

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

例外例外
例外の種類条件

ArgumentNullException

assemblyFile が null 参照 (Visual Basic では Nothing) です。

FileNotFoundException

assemblyFile が見つかりません。

BadImageFormatException

assemblyFile が有効なアセンブリではありません。

AppDomainUnloadedException

操作が、アンロードされたアプリケーション ドメインで試行されています。

FileLoadException

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

解説解説
使用例使用例

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

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 'Main

End Module 'Test
class Test {
   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"
   }
}
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"
}

.NET Framework のセキュリティ.NET Framework のセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

AppDomain.ExecuteAssembly メソッド (String, Evidence, String[], Byte[], AssemblyHashAlgorithm)

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

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Function ExecuteAssembly ( _
    assemblyFile As String, _
    assemblySecurity As Evidence, _
    args As String(), _
    hashValue As Byte(), _
    hashAlgorithm As AssemblyHashAlgorithm _
) As Integer
Dim instance As AppDomain
Dim assemblyFile As String
Dim assemblySecurity As Evidence
Dim args As String()
Dim hashValue As Byte()
Dim hashAlgorithm As AssemblyHashAlgorithm
Dim returnValue As Integer

returnValue = instance.ExecuteAssembly(assemblyFile, assemblySecurity, args, hashValue,
 hashAlgorithm)
public int ExecuteAssembly (
    string assemblyFile,
    Evidence assemblySecurity,
    string[] args,
    byte[] hashValue,
    AssemblyHashAlgorithm hashAlgorithm
)
public:
int ExecuteAssembly (
    String^ assemblyFile, 
    Evidence^ assemblySecurity, 
    array<String^>^ args, 
    array<unsigned char>^ hashValue, 
    AssemblyHashAlgorithm hashAlgorithm
)
public int ExecuteAssembly (
    String assemblyFile, 
    Evidence assemblySecurity, 
    String[] args, 
    byte[] hashValue, 
    AssemblyHashAlgorithm hashAlgorithm
)
public function ExecuteAssembly (
    assemblyFile : String, 
    assemblySecurity : Evidence, 
    args : String[], 
    hashValue : byte[], 
    hashAlgorithm : AssemblyHashAlgorithm
) : int

パラメータ

assemblyFile

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

assemblySecurity

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

args

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

hashValue

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

hashAlgorithm

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

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

例外例外
例外の種類条件

ArgumentNullException

assemblyFile が null 参照 (Visual Basic では Nothing) です。

FileNotFoundException

assemblyFile が見つかりません。

BadImageFormatException

assemblyFile が有効なアセンブリではありません。

AppDomainUnloadedException

操作が、アンロードされたアプリケーション ドメインで試行されています。

FileLoadException

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

解説解説
使用例使用例

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

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 'Main

End Module 'Test
class Test {
   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"
   }
}
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"
}

.NET Framework のセキュリティ.NET Framework のセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

_AppDomain.ExecuteAssembly メソッド




英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「AppDomain.ExecuteAssembly」の関連用語

AppDomain.ExecuteAssemblyのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



AppDomain.ExecuteAssemblyのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS