AppDomain.ExecuteAssembly Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Executes the assembly contained in the specified file.
Overloads
ExecuteAssembly(String, Evidence, String[], Byte[], AssemblyHashAlgorithm) |
Obsolete.
Executes the assembly contained in the specified file, using the specified evidence, arguments, hash value, and hash algorithm. |
ExecuteAssembly(String, Evidence, String[]) |
Obsolete.
Executes the assembly contained in the specified file, using the specified evidence and arguments. |
ExecuteAssembly(String, String[], Byte[], AssemblyHashAlgorithm) |
Obsolete.
Executes the assembly contained in the specified file, using the specified arguments, hash value, and hash algorithm. |
ExecuteAssembly(String, Evidence) |
Obsolete.
Executes the assembly contained in the specified file, using the specified evidence. |
ExecuteAssembly(String, String[]) |
Executes the assembly contained in the specified file, using the specified arguments. |
ExecuteAssembly(String) |
Executes the assembly contained in the specified file. |
ExecuteAssembly(String, Evidence, String[], Byte[], AssemblyHashAlgorithm)
Caution
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.
Executes the assembly contained in the specified file, using the specified evidence, arguments, hash value, and hash algorithm.
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
Parameters
- assemblyFile
- String
The name of the file that contains the assembly to execute.
- assemblySecurity
- Evidence
The supplied evidence for the assembly.
- args
- String[]
The arguments to the entry point of the assembly.
- hashValue
- Byte[]
Represents the value of the computed hash code.
- hashAlgorithm
- AssemblyHashAlgorithm
Represents the hash algorithm used by the assembly manifest.
Returns
The value returned by the entry point of the assembly.
- Attributes
Exceptions
assemblyFile
is null
.
assemblyFile
is not found.
assemblyFile
is not a valid assembly for the currently loaded runtime.
The operation is attempted on an unloaded application domain.
An assembly or module was loaded twice with two different evidences.
assemblySecurity
is not null
. When legacy CAS policy is not enabled, assemblySecurity
should be null
.
The specified assembly has no entry point.
Examples
The following sample demonstrates using one of the overloads of ExecuteAssembly on two different domains.
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
Remarks
The assembly begins executing at the entry point specified in the .NET Framework header.
This method does not create a new process or application domain, and it does not execute the entry point method on a new thread.
This method loads assemblies using the LoadFile method. You can also execute assemblies using the ExecuteAssemblyByName method, which loads assemblies using the Load method.
Applies to
ExecuteAssembly(String, Evidence, String[])
Caution
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.
Executes the assembly contained in the specified file, using the specified evidence and arguments.
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
Parameters
- assemblyFile
- String
The name of the file that contains the assembly to execute.
- assemblySecurity
- Evidence
The supplied evidence for the assembly.
- args
- String[]
The arguments to the entry point of the assembly.
Returns
The value returned by the entry point of the assembly.
Implements
- Attributes
Exceptions
assemblyFile
is null
.
assemblyFile
is not found.
assemblyFile
is not a valid assembly for the currently loaded runtime.
The operation is attempted on an unloaded application domain.
An assembly or module was loaded twice with two different evidences.
assemblySecurity
is not null
. When legacy CAS policy is not enabled, assemblySecurity
should be null
.
The specified assembly has no entry point.
Examples
The following sample demonstrates using one of the overloads of ExecuteAssembly on two different domains.
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
Remarks
The assembly begins executing at the entry point specified in the .NET Framework header.
This method does not create a new process or application domain, and it does not execute the entry point method on a new thread.
This method loads assemblies using the LoadFile method. You can also execute assemblies using the ExecuteAssemblyByName method, which loads assemblies using the Load method.
Applies to
ExecuteAssembly(String, String[], Byte[], AssemblyHashAlgorithm)
- Source:
- AppDomain.cs
- Source:
- AppDomain.cs
- Source:
- AppDomain.cs
Caution
Code Access Security is not supported or honored by the runtime.
Executes the assembly contained in the specified file, using the specified arguments, hash value, and hash algorithm.
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
Parameters
- assemblyFile
- String
The name of the file that contains the assembly to execute.
- args
- String[]
The arguments to the entry point of the assembly.
- hashValue
- Byte[]
Represents the value of the computed hash code.
- hashAlgorithm
- AssemblyHashAlgorithm
Represents the hash algorithm used by the assembly manifest.
Returns
The value that is returned by the entry point of the assembly.
- Attributes
Exceptions
assemblyFile
is null
.
assemblyFile
is not found.
assemblyFile
is not a valid assembly for the currently loaded runtime.
The operation is attempted on an unloaded application domain.
An assembly or module was loaded twice with two different evidences.
The specified assembly has no entry point.
Examples
The following sample demonstrates using one of the overloads of ExecuteAssembly on two different domains.
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
Remarks
Caution
Code Access Security (CAS) has been deprecated across all versions of .NET Framework and .NET. Recent versions of .NET do not honor CAS annotations and produce errors if CAS-related APIs are used. Developers should seek alternative means of accomplishing security tasks.
The assembly begins executing at the entry point specified in the .NET Framework header.
This method does not create a new process or application domain, and it does not execute the entry point method on a new thread.
This method loads assemblies using the LoadFile method. You can also execute assemblies using the ExecuteAssemblyByName method, which loads assemblies using the Load method.
Applies to
ExecuteAssembly(String, Evidence)
Caution
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.
Executes the assembly contained in the specified file, using the specified evidence.
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
Parameters
- assemblyFile
- String
The name of the file that contains the assembly to execute.
- assemblySecurity
- Evidence
Evidence for loading the assembly.
Returns
The value returned by the entry point of the assembly.
Implements
- Attributes
Exceptions
assemblyFile
is null
.
assemblyFile
is not found.
assemblyFile
is not a valid assembly for the currently loaded runtime.
The operation is attempted on an unloaded application domain.
An assembly or module was loaded twice with two different evidences.
The specified assembly has no entry point.
Examples
The following sample demonstrates using one of the overloads of ExecuteAssembly on two different domains.
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
Remarks
The assembly begins executing at the entry point specified in the .NET Framework header.
The ExecuteAssembly method does not create a new process or application domain, and it does not execute the entry point method on a new thread.
This method loads assemblies using the LoadFile method. You can also execute assemblies using the ExecuteAssemblyByName method, which loads assemblies using the Load method.
Applies to
ExecuteAssembly(String, String[])
- Source:
- AppDomain.cs
- Source:
- AppDomain.cs
- Source:
- AppDomain.cs
Executes the assembly contained in the specified file, using the specified arguments.
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
Parameters
- assemblyFile
- String
The name of the file that contains the assembly to execute.
- args
- String[]
The arguments to the entry point of the assembly.
Returns
The value that is returned by the entry point of the assembly.
Exceptions
assemblyFile
is null
.
assemblyFile
is not found.
assemblyFile
is not a valid assembly for the currently loaded runtime.
The operation is attempted on an unloaded application domain.
An assembly or module was loaded twice with two different evidences.
The specified assembly has no entry point.
Examples
The following sample demonstrates using one of the overloads of ExecuteAssembly on two different domains.
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
Remarks
The assembly begins executing at the entry point specified in the .NET Framework header.
This method does not create a new process or application domain, and it does not execute the entry point method on a new thread.
This method loads assemblies using the LoadFile method. You can also execute assemblies using the ExecuteAssemblyByName method, which loads assemblies using the Load method.
Applies to
ExecuteAssembly(String)
- Source:
- AppDomain.cs
- Source:
- AppDomain.cs
- Source:
- AppDomain.cs
Executes the assembly contained in the specified file.
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
Parameters
- assemblyFile
- String
The name of the file that contains the assembly to execute.
Returns
The value returned by the entry point of the assembly.
Implements
Exceptions
assemblyFile
is null
.
assemblyFile
is not found.
assemblyFile
is not a valid assembly for the currently loaded runtime.
The operation is attempted on an unloaded application domain.
An assembly or module was loaded twice with two different evidences.
The specified assembly has no entry point.
Examples
The following sample demonstrates using one of the overloads of ExecuteAssembly on two different domains.
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
Remarks
The assembly begins executing at the entry point specified in the .NET Framework header.
This method does not create a new process or application domain, and it does not execute the entry point method on a new thread.
This method loads assemblies using the LoadFile method. You can also execute assemblies using the ExecuteAssemblyByName method, which loads assemblies using the Load method.
To create the AppDomain to load and execute, use the CreateDomain method.