AppDomain.ExecuteAssemblyByName Method

Definition

Executes an assembly.

Overloads

ExecuteAssemblyByName(String)

Executes an assembly given its display name.

ExecuteAssemblyByName(AssemblyName, String[])

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

ExecuteAssemblyByName(String, Evidence)

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

ExecuteAssemblyByName(String, String[])

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

ExecuteAssemblyByName(AssemblyName, Evidence, String[])

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

ExecuteAssemblyByName(String, Evidence, String[])

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

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

The display name of the assembly. See FullName.

Returns

The value returned by the entry point of the assembly.

Exceptions

assemblyName is null.

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 operation is attempted on an unloaded application domain.

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

The specified assembly has no entry point.

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.

See also

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

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.

The operation is attempted on an unloaded application domain.

The specified assembly has no entry point.

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.

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);
public int ExecuteAssemblyByName (string assemblyName, 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 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);
[System.Obsolete("Use an overload that does not take an Evidence parameter")]
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

The display name of the assembly. See FullName.

assemblySecurity
Evidence

Evidence for loading the assembly.

Returns

The value returned by the entry point of the assembly.

Attributes

Exceptions

assemblyName is null.

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.

The operation is attempted on an unloaded application domain.

The specified assembly has no entry point.

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.

See also

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

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

assemblyName is null.

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.

The operation is attempted on an unloaded application domain.

The specified assembly has no entry point.

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.

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);
public int ExecuteAssemblyByName (System.Reflection.AssemblyName assemblyName, System.Security.Policy.Evidence assemblySecurity, params 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 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);
[System.Obsolete("Use an overload that does not take an Evidence parameter")]
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

An AssemblyName object representing the name of the assembly.

assemblySecurity
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.

Attributes

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.

The operation is attempted on an unloaded application domain.

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

The specified assembly has no entry point.

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.

See also

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);
public int ExecuteAssemblyByName (string assemblyName, System.Security.Policy.Evidence assemblySecurity, params 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 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);
[System.Obsolete("Use an overload that does not take an Evidence parameter")]
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

The display name of the assembly. See FullName.

assemblySecurity
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.

Attributes

Exceptions

assemblyName is null.

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.

The operation is attempted on an unloaded application domain.

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

The specified assembly has no entry point.

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.

See also

Applies to