AppDomain.ExecuteAssembly Method (String, Evidence, String())
Executes the assembly contained in the specified file, using the specified evidence and arguments.
Assembly: mscorlib (in mscorlib.dll)
<ObsoleteAttribute("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 Function ExecuteAssembly ( assemblyFile As String, assemblySecurity As Evidence, args As String() ) As Integer
The name of the file that contains the assembly to execute.
The supplied evidence for the assembly.
The arguments to the entry point of the assembly.
Return ValueType: System.Int32
The value returned by the entry point of the assembly.
assemblyFile is null.
assemblyFile is not found.
assemblyFile is not a valid assembly.
Version 2.0 or later of the common language runtime is currently loaded and assemblyFile was compiled with a later version.
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.
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.
The following sample demonstrates using one of the overloads of ExecuteAssembly on two different domains.
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 'Main End Module 'Test
to load an assembly with evidence. Associated enumeration: SecurityPermissionFlag.ControlEvidence.
for reading a URI that does not begin with "file://".
to execute a console application. Associated enumeration: PermissionState.Unrestricted.
Available since 1.1