AppDomain.ExecuteAssembly Metoda

Definice

Spustí sestavení obsažené v zadaném souboru.

Přetížení

Name Description
ExecuteAssembly(String, Evidence, String[], Byte[], AssemblyHashAlgorithm)
Zastaralé.

Spustí sestavení obsažené v zadaném souboru pomocí zadaných důkazů, argumentů, hodnot hash a algoritmu hash.

ExecuteAssembly(String, Evidence, String[])
Zastaralé.

Spustí sestavení obsažené v zadaném souboru pomocí zadaných důkazů a argumentů.

ExecuteAssembly(String, String[], Byte[], AssemblyHashAlgorithm)
Zastaralé.

Spustí sestavení obsažené v zadaném souboru pomocí zadaných argumentů, hodnoty hash a hashovacího algoritmu.

ExecuteAssembly(String, Evidence)
Zastaralé.

Spustí sestavení obsažené v zadaném souboru pomocí zadaných důkazů.

ExecuteAssembly(String, String[])

Spustí sestavení obsažené v zadaném souboru pomocí zadaných argumentů.

ExecuteAssembly(String)

Spustí sestavení obsažené v zadaném souboru.

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

Upozornění

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.

Spustí sestavení obsažené v zadaném souboru pomocí zadaných důkazů, argumentů, hodnot hash a algoritmu hash.

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

Parametry

assemblyFile
String

Název souboru, který obsahuje sestavení ke spuštění.

assemblySecurity
Evidence

Dodané důkazy pro sestavení.

args
String[]

Argumenty vstupního bodu sestavení.

hashValue
Byte[]

Představuje hodnotu vypočítaného kódu hash.

hashAlgorithm
AssemblyHashAlgorithm

Představuje hashovací algoritmus používaný manifestem sestavení.

Návraty

Hodnota vrácená vstupním bodem sestavení.

Atributy

Výjimky

assemblyFile je null.

assemblyFile nebyl nalezen.

assemblyFile není platné sestavení pro aktuálně načtený modul runtime.

Operace se pokusí o uvolněnou doménu aplikace.

Sestavení nebo modul byl načten dvakrát se dvěma různými důkazy.

assemblySecurity není null. Pokud starší zásada CAS není povolená, assemblySecurity měla by být null.

Zadané sestavení nemá žádný vstupní bod.

Platí pro

ExecuteAssembly(String, Evidence, String[])

Upozornění

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.

Spustí sestavení obsažené v zadaném souboru pomocí zadaných důkazů a argumentů.

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

Parametry

assemblyFile
String

Název souboru, který obsahuje sestavení ke spuštění.

assemblySecurity
Evidence

Dodané důkazy pro sestavení.

args
String[]

Argumenty vstupního bodu sestavení.

Návraty

Hodnota vrácená vstupním bodem sestavení.

Implementuje

Atributy

Výjimky

assemblyFile je null.

assemblyFile nebyl nalezen.

assemblyFile není platné sestavení pro aktuálně načtený modul runtime.

Operace se pokusí o uvolněnou doménu aplikace.

Sestavení nebo modul byl načten dvakrát se dvěma různými důkazy.

assemblySecurity není null. Pokud starší zásada CAS není povolená, assemblySecurity měla by být null.

Zadané sestavení nemá žádný vstupní bod.

Platí pro

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

Zdroj:
AppDomain.cs
Zdroj:
AppDomain.cs
Zdroj:
AppDomain.cs
Zdroj:
AppDomain.cs
Zdroj:
AppDomain.cs

Upozornění

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

Spustí sestavení obsažené v zadaném souboru pomocí zadaných argumentů, hodnoty hash a hashovacího algoritmu.

public:
 int ExecuteAssembly(System::String ^ assemblyFile, cli::array <System::String ^> ^ args, cli::array <System::Byte> ^ hashValue, System::Configuration::Assemblies::AssemblyHashAlgorithm hashAlgorithm);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")]
[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);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")]
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);
public int ExecuteAssembly(string assemblyFile, string?[]? args, byte[]? hashValue, System.Configuration.Assemblies.AssemblyHashAlgorithm hashAlgorithm);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")>]
[<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
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")>]
member this.ExecuteAssembly : string * string[] * byte[] * System.Configuration.Assemblies.AssemblyHashAlgorithm -> int
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

Parametry

assemblyFile
String

Název souboru, který obsahuje sestavení ke spuštění.

args
String[]

Argumenty vstupního bodu sestavení.

hashValue
Byte[]

Představuje hodnotu vypočítaného kódu hash.

hashAlgorithm
AssemblyHashAlgorithm

Představuje hashovací algoritmus používaný manifestem sestavení.

Návraty

Hodnota vrácená vstupním bodem sestavení.

Atributy

Výjimky

assemblyFile je null.

assemblyFile nebyl nalezen.

assemblyFile není platné sestavení pro aktuálně načtený modul runtime.

Operace se pokusí o uvolněnou doménu aplikace.

Sestavení nebo modul byl načten dvakrát se dvěma různými důkazy.

Zadané sestavení nemá žádný vstupní bod.

Platí pro

ExecuteAssembly(String, Evidence)

Upozornění

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.

Spustí sestavení obsažené v zadaném souboru pomocí zadaných důkazů.

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

Parametry

assemblyFile
String

Název souboru, který obsahuje sestavení ke spuštění.

assemblySecurity
Evidence

Důkaz pro načtení sestavení.

Návraty

Hodnota vrácená vstupním bodem sestavení.

Implementuje

Atributy

Výjimky

assemblyFile je null.

assemblyFile nebyl nalezen.

assemblyFile není platné sestavení pro aktuálně načtený modul runtime.

Operace se pokusí o uvolněnou doménu aplikace.

Sestavení nebo modul byl načten dvakrát se dvěma různými důkazy.

Zadané sestavení nemá žádný vstupní bod.

Platí pro

ExecuteAssembly(String, String[])

Zdroj:
AppDomain.cs
Zdroj:
AppDomain.cs
Zdroj:
AppDomain.cs
Zdroj:
AppDomain.cs
Zdroj:
AppDomain.cs

Spustí sestavení obsažené v zadaném souboru pomocí zadaných argumentů.

public:
 int ExecuteAssembly(System::String ^ assemblyFile, cli::array <System::String ^> ^ args);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")]
public int ExecuteAssembly(string assemblyFile, string?[]? args);
public int ExecuteAssembly(string assemblyFile, string[] args);
public int ExecuteAssembly(string assemblyFile, string?[]? args);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")>]
member this.ExecuteAssembly : string * string[] -> int
member this.ExecuteAssembly : string * string[] -> int
Public Function ExecuteAssembly (assemblyFile As String, args As String()) As Integer

Parametry

assemblyFile
String

Název souboru, který obsahuje sestavení ke spuštění.

args
String[]

Argumenty vstupního bodu sestavení.

Návraty

Hodnota vrácená vstupním bodem sestavení.

Atributy

Výjimky

assemblyFile je null.

assemblyFile nebyl nalezen.

assemblyFile není platné sestavení pro aktuálně načtený modul runtime.

Operace se pokusí o uvolněnou doménu aplikace.

Sestavení nebo modul byl načten dvakrát se dvěma různými důkazy.

Zadané sestavení nemá žádný vstupní bod.

Příklady

Následující ukázka ukazuje použití jednoho z přetížení na ExecuteAssembly dvou různých doménách.

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

Poznámky

Sestavení začne provádět v vstupním bodě zadaném v hlavičce .NET.

Tato metoda nevytvoří nový proces nebo doménu aplikace a nespustí metodu vstupního bodu v novém vlákně.

Tato metoda načte sestavení pomocí LoadFile metody. Sestavení můžete také spustit pomocí ExecuteAssemblyByName metody, která načte sestavení pomocí Load metody.

Platí pro

ExecuteAssembly(String)

Zdroj:
AppDomain.cs
Zdroj:
AppDomain.cs
Zdroj:
AppDomain.cs
Zdroj:
AppDomain.cs
Zdroj:
AppDomain.cs

Spustí sestavení obsažené v zadaném souboru.

public:
 int ExecuteAssembly(System::String ^ assemblyFile);
public:
 virtual int ExecuteAssembly(System::String ^ assemblyFile);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")]
public int ExecuteAssembly(string assemblyFile);
public int ExecuteAssembly(string assemblyFile);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")>]
member this.ExecuteAssembly : string -> int
member this.ExecuteAssembly : string -> int
abstract member ExecuteAssembly : string -> int
override this.ExecuteAssembly : string -> int
Public Function ExecuteAssembly (assemblyFile As String) As Integer

Parametry

assemblyFile
String

Název souboru, který obsahuje sestavení ke spuštění.

Návraty

Hodnota vrácená vstupním bodem sestavení.

Implementuje

Atributy

Výjimky

assemblyFile je null.

assemblyFile nebyl nalezen.

assemblyFile není platné sestavení pro aktuálně načtený modul runtime.

Operace se pokusí o uvolněnou doménu aplikace.

Sestavení nebo modul byl načten dvakrát se dvěma různými důkazy.

Zadané sestavení nemá žádný vstupní bod.

Příklady

Následující ukázka ukazuje použití jednoho z přetížení na ExecuteAssembly dvou různých doménách.

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

Poznámky

Sestavení začne provádět v vstupním bodě zadaném v hlavičce .NET.

Tato metoda nevytvoří nový proces nebo doménu aplikace a nespustí metodu vstupního bodu v novém vlákně.

Tato metoda načte sestavení pomocí LoadFile metody. Sestavení můžete také spustit pomocí ExecuteAssemblyByName metody, která načte sestavení pomocí Load metody.

K vytvoření AppDomain načtení a spuštění použijte metodu CreateDomain .

Platí pro