AppDomain.ExecuteAssemblyByName AppDomain.ExecuteAssemblyByName AppDomain.ExecuteAssemblyByName AppDomain.ExecuteAssemblyByName Method

Definition

Executes an assembly.

Overloads

ExecuteAssemblyByName(String) ExecuteAssemblyByName(String) ExecuteAssemblyByName(String) ExecuteAssemblyByName(String)

Executes an assembly given its display name.

ExecuteAssemblyByName(AssemblyName, String[]) ExecuteAssemblyByName(AssemblyName, String[]) ExecuteAssemblyByName(AssemblyName, String[])

Executes the assembly given an AssemblyName, using the specified arguments.

ExecuteAssemblyByName(String, Evidence) ExecuteAssemblyByName(String, Evidence) ExecuteAssemblyByName(String, Evidence) ExecuteAssemblyByName(String, Evidence)

Executes an assembly given its display name, using the specified evidence.

ExecuteAssemblyByName(String, String[]) ExecuteAssemblyByName(String, String[]) ExecuteAssemblyByName(String, String[]) ExecuteAssemblyByName(String, String[])

Executes the assembly given its display name, using the specified arguments.

ExecuteAssemblyByName(AssemblyName, Evidence, String[]) ExecuteAssemblyByName(AssemblyName, Evidence, String[]) ExecuteAssemblyByName(AssemblyName, Evidence, String[])

Executes the assembly given an AssemblyName, using the specified evidence and arguments.

ExecuteAssemblyByName(String, Evidence, String[]) ExecuteAssemblyByName(String, Evidence, String[]) ExecuteAssemblyByName(String, Evidence, String[]) ExecuteAssemblyByName(String, Evidence, String[])

Executes the assembly given its display name, using the specified evidence and arguments.

ExecuteAssemblyByName(String) ExecuteAssemblyByName(String) ExecuteAssemblyByName(String) ExecuteAssemblyByName(String)

Executes an assembly given its display name.

public:
 int ExecuteAssemblyByName(System::String ^ assemblyName);
public int ExecuteAssemblyByName (string assemblyName);
member this.ExecuteAssemblyByName : string -> int
Public Function ExecuteAssemblyByName (assemblyName As String) As Integer

Parameters

assemblyName
String String String String

The display name of the assembly. See FullName.

Returns

The value returned by the entry point of the assembly.

Exceptions

The assembly specified by assemblyName is not found.

The assembly specified by assemblyName is not a valid assembly.

-or-

Version 2.0 or later of the common language runtime is currently loaded and assemblyName was compiled with a later version.

The assembly specified by assemblyName was found, but could not be loaded.

Remarks

The ExecuteAssemblyByName method provides similar functionality to the ExecuteAssembly method, but specifies the assembly by display name or AssemblyName rather than by file location. Therefore, ExecuteAssemblyByName loads assemblies with the Load method rather than with the LoadFile method.

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.

To create the AppDomain to load and execute, use the CreateDomain method.

Security

FileIOPermission
for access to read from a file or directory, for access to the information in the path itself, and for redirecting a display name to a path. Associated enumerations: Read, PathDiscovery.

WebPermission
for access to a Web site, when a display name is redirected to a URL.

UIPermission
to execute a console application. Associated enumeration: Unrestricted.

See Also

ExecuteAssemblyByName(AssemblyName, String[]) ExecuteAssemblyByName(AssemblyName, String[]) ExecuteAssemblyByName(AssemblyName, String[])

Executes the assembly given an AssemblyName, using the specified arguments.

public:
 int ExecuteAssemblyByName(System::Reflection::AssemblyName ^ assemblyName, ... cli::array <System::String ^> ^ args);
public int ExecuteAssemblyByName (System.Reflection.AssemblyName assemblyName, params string[] args);
member this.ExecuteAssemblyByName : System.Reflection.AssemblyName * string[] -> int

Parameters

assemblyName
AssemblyName AssemblyName AssemblyName AssemblyName

An AssemblyName object representing the name of the assembly.

args
String[]

Command-line arguments to pass when starting the process.

Returns

The value that is returned by the entry point of the assembly.

Exceptions

The assembly specified by assemblyName is not found.

The assembly specified by assemblyName was found, but could not be loaded.

The assembly specified by assemblyName is not a valid assembly.

-or-

assemblyName was compiled with a later version of the common language runtime than the version that is currently loaded.

Remarks

The ExecuteAssemblyByName method provides similar functionality to the ExecuteAssembly method, but specifies the assembly by display name or AssemblyName rather than by file location. Therefore, ExecuteAssemblyByName loads assemblies with the Load method rather than with the LoadFile method.

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.

Security

FileIOPermission
for access to read from a file or directory, for access to the information in the path itself, and for redirecting a display name to a path. Associated enumerations: Read, PathDiscovery.

WebPermission
for access to a Web site, when a display name is redirected to a URL.

UIPermission
to execute a console application. Associated enumeration: Unrestricted.

ExecuteAssemblyByName(String, Evidence) ExecuteAssemblyByName(String, Evidence) ExecuteAssemblyByName(String, Evidence) ExecuteAssemblyByName(String, Evidence)

Warning

This API is now obsolete.

Executes an assembly given its display name, using the specified evidence.

public:
 int ExecuteAssemblyByName(System::String ^ assemblyName, System::Security::Policy::Evidence ^ assemblySecurity);
[System.Obsolete("Use an overload that does not take an Evidence parameter")]
[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 ExecuteAssemblyByName which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
public int ExecuteAssemblyByName (string assemblyName, System.Security.Policy.Evidence assemblySecurity);
member this.ExecuteAssemblyByName : string * System.Security.Policy.Evidence -> int
Public Function ExecuteAssemblyByName (assemblyName As String, assemblySecurity As Evidence) As Integer

Parameters

assemblyName
String String String String

The display name of the assembly. See FullName.

assemblySecurity
Evidence Evidence Evidence Evidence

Evidence for loading the assembly.

Returns

The value returned by the entry point of the assembly.

Exceptions

The assembly specified by assemblyName is not found.

The assembly specified by assemblyName was found, but could not be loaded.

The assembly specified by assemblyName is not a valid assembly.

-or-

Version 2.0 or later of the common language runtime is currently loaded and assemblyName was compiled with a later version.

Remarks

The ExecuteAssemblyByName method provides similar functionality to the ExecuteAssembly method, but specifies the assembly by display name or AssemblyName rather than by file location. Therefore, ExecuteAssemblyByName loads assemblies with the Load method rather than with the LoadFile method.

The assembly begins executing at the entry point specified in the .NET Framework header.

The ExecuteAssemblyByName method does not create a new process or application domain, and it does not execute the entry point method on a new thread.

Note

When you use the ExecuteAssemblyByName method with an Evidence parameter, pieces of evidence are merged. Pieces of evidence supplied as an argument to the ExecuteAssemblyByName method supersede pieces of evidence supplied by the loader.

Security

FileIOPermission
for access to read from a file or directory, for access to the information in the path itself, and for redirecting a display name to a path. Associated enumerations: Read, PathDiscovery.

SecurityPermission
to load an assembly with evidence. Associated enumeration: ControlEvidence.

WebPermission
for access to a Web site, when a display name is redirected to a URL.

UIPermission
to execute a console application. Associated enumeration: Unrestricted.

See Also

ExecuteAssemblyByName(String, String[]) ExecuteAssemblyByName(String, String[]) ExecuteAssemblyByName(String, String[]) ExecuteAssemblyByName(String, String[])

Executes the assembly given its display name, using the specified arguments.

public:
 int ExecuteAssemblyByName(System::String ^ assemblyName, ... cli::array <System::String ^> ^ args);
public int ExecuteAssemblyByName (string assemblyName, params string[] args);
member this.ExecuteAssemblyByName : string * string[] -> int
Public Function ExecuteAssemblyByName (assemblyName As String, ParamArray args As String()) As Integer

Parameters

assemblyName
String String String String

The display name of the assembly. See FullName.

args
String[]

Command-line arguments to pass when starting the process.

Returns

The value that is returned by the entry point of the assembly.

Exceptions

The assembly specified by assemblyName is not found.

The assembly specified by assemblyName was found, but could not be loaded.

The assembly specified by assemblyName is not a valid assembly.

-or-

assemblyName was compiled with a later version of the common language runtime than the version that is currently loaded.

Remarks

The ExecuteAssemblyByName method provides similar functionality to the ExecuteAssembly method, but specifies the assembly by display name or AssemblyName rather than by file location. Therefore, ExecuteAssemblyByName loads assemblies with the Load method rather than with the LoadFile method.

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.

Security

FileIOPermission
for access to read from a file or directory, for access to the information in the path itself, and for redirecting a display name to a path. Associated enumerations: Read, PathDiscovery.

WebPermission
for access to a Web site, when a display name is redirected to a URL.

UIPermission
to execute a console application. Associated enumeration: Unrestricted.

ExecuteAssemblyByName(AssemblyName, Evidence, String[]) ExecuteAssemblyByName(AssemblyName, Evidence, String[]) ExecuteAssemblyByName(AssemblyName, Evidence, String[])

Warning

This API is now obsolete.

Executes the assembly given an AssemblyName, using the specified evidence and arguments.

public:
 int ExecuteAssemblyByName(System::Reflection::AssemblyName ^ assemblyName, System::Security::Policy::Evidence ^ assemblySecurity, ... cli::array <System::String ^> ^ args);
[System.Obsolete("Use an overload that does not take an Evidence parameter")]
[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 ExecuteAssemblyByName which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
public int ExecuteAssemblyByName (System.Reflection.AssemblyName assemblyName, System.Security.Policy.Evidence assemblySecurity, params string[] args);
member this.ExecuteAssemblyByName : System.Reflection.AssemblyName * System.Security.Policy.Evidence * string[] -> int

Parameters

assemblyName
AssemblyName AssemblyName AssemblyName AssemblyName

An AssemblyName object representing the name of the assembly.

assemblySecurity
Evidence Evidence Evidence Evidence

Evidence for loading the assembly.

args
String[]

Command-line arguments to pass when starting the process.

Returns

The value returned by the entry point of the assembly.

Exceptions

The assembly specified by assemblyName is not found.

The assembly specified by assemblyName was found, but could not be loaded.

The assembly specified by assemblyName is not a valid assembly.

-or-

Version 2.0 or later of the common language runtime is currently loaded and assemblyName was compiled with a later version.

assemblySecurity is not null. When legacy CAS policy is not enabled, assemblySecurity should be null.

Remarks

The ExecuteAssemblyByName method provides similar functionality to the ExecuteAssembly method, but specifies the assembly by display name or AssemblyName rather than by file location. Therefore, ExecuteAssemblyByName loads assemblies with the Load method rather than with the LoadFile method.

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.

Note

When you use the ExecuteAssemblyByName method with an Evidence parameter, pieces of evidence are merged. Pieces of evidence supplied as an argument to the ExecuteAssemblyByName method supersede pieces of evidence supplied by the loader.

Security

FileIOPermission
for access to read from a file or directory, for access to the information in the path itself, and for redirecting a display name to a path. Associated enumerations: Read, PathDiscovery.

SecurityPermission
to load an assembly with evidence. Associated enumeration: ControlEvidence.

WebPermission
for access to a Web site, when a display name is redirected to a URL.

UIPermission
to execute a console application. Associated enumeration: Unrestricted.

See Also

ExecuteAssemblyByName(String, Evidence, String[]) ExecuteAssemblyByName(String, Evidence, String[]) ExecuteAssemblyByName(String, Evidence, String[]) ExecuteAssemblyByName(String, Evidence, String[])

Warning

This API is now obsolete.

Executes the assembly given its display name, using the specified evidence and arguments.

public:
 int ExecuteAssemblyByName(System::String ^ assemblyName, System::Security::Policy::Evidence ^ assemblySecurity, ... cli::array <System::String ^> ^ args);
[System.Obsolete("Use an overload that does not take an Evidence parameter")]
[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 ExecuteAssemblyByName which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
public int ExecuteAssemblyByName (string assemblyName, System.Security.Policy.Evidence assemblySecurity, params string[] args);
member this.ExecuteAssemblyByName : string * System.Security.Policy.Evidence * string[] -> int
Public Function ExecuteAssemblyByName (assemblyName As String, assemblySecurity As Evidence, ParamArray args As String()) As Integer

Parameters

assemblyName
String String String String

The display name of the assembly. See FullName.

assemblySecurity
Evidence Evidence Evidence Evidence

Evidence for loading the assembly.

args
String[]

Command-line arguments to pass when starting the process.

Returns

The value returned by the entry point of the assembly.

Exceptions

The assembly specified by assemblyName is not found.

The assembly specified by assemblyName was found, but could not be loaded.

The assembly specified by assemblyName is not a valid assembly.

-or-

Version 2.0 or later of the common language runtime is currently loaded and assemblyName was compiled with a later version.

assemblySecurity is not null. When legacy CAS policy is not enabled, assemblySecurity should be null.

Remarks

The ExecuteAssemblyByName method provides similar functionality to the ExecuteAssembly method, but specifies the assembly by display name or AssemblyName rather than by file location. Therefore, ExecuteAssemblyByName loads assemblies with the Load method rather than with the LoadFile method.

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.

Note

When you use the ExecuteAssemblyByName method with an Evidence parameter, pieces of evidence are merged. Pieces of evidence supplied as an argument to the ExecuteAssemblyByName method supersede pieces of evidence supplied by the loader.

Security

FileIOPermission
for access to read from a file or directory, for access to the information in the path itself, and for redirecting a display name to a path. Associated enumerations: Read, PathDiscovery.

SecurityPermission
to load an assembly with evidence. Associated enumeration: ControlEvidence.

WebPermission
for access to a Web site, when a display name is redirected to a URL.

UIPermission
to execute a console application. Associated enumeration: Unrestricted.

See Also

Applies to