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)
Obsolete.

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[])
Obsolete.

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

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

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 for the currently loaded runtime.

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

Applies to

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);
public int ExecuteAssemblyByName (System.Reflection.AssemblyName assemblyName, params string[] args);
member this.ExecuteAssemblyByName : System.Reflection.AssemblyName * string[] -> int
Public Function ExecuteAssemblyByName (assemblyName As AssemblyName, ParamArray args As String()) As Integer

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 for the currently loaded runtime.

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.

Applies to

ExecuteAssemblyByName(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 ExecuteAssemblyByName which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.

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);
member this.ExecuteAssemblyByName : 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 ExecuteAssemblyByName which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")>]
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 for the currently loaded runtime.

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

Applies to

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);
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 for the currently loaded runtime.

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.

Applies to

ExecuteAssemblyByName(AssemblyName, 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 ExecuteAssemblyByName which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.

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

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 for the currently loaded runtime.

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

ExecuteAssemblyByName(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 ExecuteAssemblyByName which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.

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);
member this.ExecuteAssemblyByName : 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 ExecuteAssemblyByName which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")>]
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 for the currently loaded runtime.

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