AppDomain.ExecuteAssembly Metoda

Definice

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

Přetížení

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

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

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ého důkazu.

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ů, hodnoty hash a hash algoritmu.

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

Předaný důkaz pro sestavení.

args
String[]

Argumenty vstupního bodu sestavení.

hashValue
Byte[]

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

hashAlgorithm
AssemblyHashAlgorithm

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

Návraty

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

Atributy

Výjimky

assemblyFile je null.

assemblyFile nebyla nalezena.

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

Dojde k pokusu o operaci na uvolněné doméně aplikace.

Sestavení nebo modul byly zavedeny dvakrát se dvěma různými legitimacemi.

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

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

Příklady

Následující ukázka ukazuje použití jednoho z přetížení ve 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í zahájí provádění ve vstupním bodu, který je určen v záhlaví rozhraní .NET Framework.

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

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, 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

Předaný důkaz 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 nebyla nalezena.

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

Dojde k pokusu o operaci na uvolněné doméně aplikace.

Sestavení nebo modul byly zavedeny dvakrát se dvěma různými legitimacemi.

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

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

Příklady

Následující ukázka ukazuje použití jednoho z přetížení ve 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í zahájí provádění ve vstupním bodu, který je určen v záhlaví rozhraní .NET Framework.

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

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, String[], Byte[], AssemblyHashAlgorithm)

Source:
AppDomain.cs
Source:
AppDomain.cs
Source:
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);
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

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 hash kódu.

hashAlgorithm
AssemblyHashAlgorithm

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

Návraty

Hodnota, která je vrácena vstupním bodem sestavení.

Atributy

Výjimky

assemblyFile je null.

assemblyFile nebyla nalezena.

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

Dojde k pokusu o operaci na uvolněné doméně aplikace.

Sestavení nebo modul byly zavedeny dvakrát se dvěma různými legitimacemi.

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

Příklady

Následující ukázka ukazuje použití jednoho z přetížení ve 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

Upozornění

Zabezpečení přístupu kódu (CAS) bylo ve všech verzích rozhraní .NET Framework a .NET zastaralé. Nedávné verze rozhraní .NET nedodržují poznámky CAS a při použití rozhraní API souvisejících s cas generují chyby. Vývojáři by měli hledat alternativní způsoby provádění úloh zabezpečení.

Sestavení zahájí provádění ve vstupním bodu, který je určen v záhlaví rozhraní .NET Framework.

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

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, 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ého důkazu.

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 nebyla nalezena.

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

Dojde k pokusu o operaci na uvolněné doméně aplikace.

Sestavení nebo modul byly zavedeny dvakrát se dvěma různými legitimacemi.

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

Příklady

Následující ukázka ukazuje použití jednoho z přetížení ve 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í zahájí provádění ve vstupním bodu, který je určen v záhlaví rozhraní .NET Framework.

Metoda ExecuteAssembly 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, String[])

Source:
AppDomain.cs
Source:
AppDomain.cs
Source:
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);
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

Parametry

assemblyFile
String

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

args
String[]

Argumenty vstupního bodu sestavení.

Návraty

Hodnota, která je vrácena vstupním bodem sestavení.

Výjimky

assemblyFile je null.

assemblyFile nebyla nalezena.

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

Dojde k pokusu o operaci na uvolněné doméně aplikace.

Sestavení nebo modul byly zavedeny dvakrát se dvěma různými legitimacemi.

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

Příklady

Následující ukázka ukazuje použití jednoho z přetížení ve 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í zahájí provádění ve vstupním bodu, který je určen v záhlaví rozhraní .NET Framework.

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

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)

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

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

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

Parametry

assemblyFile
String

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

Návraty

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

Implementuje

Výjimky

assemblyFile je null.

assemblyFile nebyla nalezena.

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

Dojde k pokusu o operaci na uvolněné doméně aplikace.

Sestavení nebo modul byly zavedeny dvakrát se dvěma různými legitimacemi.

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

Příklady

Následující ukázka ukazuje použití jednoho z přetížení ve 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í zahájí provádění ve vstupním bodu, který je určen v záhlaví rozhraní .NET Framework.

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

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 k načtení a spuštění použijte metodu CreateDomain .

Platí pro