AppDomain.ExecuteAssembly Method (String, Evidence)

Note: This API is now obsolete. The non-obsolete alternative is ExecuteAssembly.

Executes the assembly contained in the specified file, using the specified evidence.

Namespace:  System
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.")>]
abstract ExecuteAssembly : 
        assemblyFile:string * 
        assemblySecurity:Evidence -> int 
[<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.")>]
override ExecuteAssembly : 
        assemblyFile:string * 
        assemblySecurity:Evidence -> int

Parameters

assemblyFile
Type: System.String

The name of the file that contains the assembly to execute.

assemblySecurity
Type: System.Security.Policy.Evidence

Evidence for loading the assembly.

Return Value

Type: System.Int32
The value returned by the entry point of the assembly.

Implements

_AppDomain.ExecuteAssembly(String, Evidence)

ExceptionCondition
ArgumentNullException

assemblyFile is a null reference (Nothing in Visual Basic).

FileNotFoundException

assemblyFile is not found.

BadImageFormatException

assemblyFile is not a valid assembly.

-or-

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

AppDomainUnloadedException

The operation is attempted on an unloaded application domain.

FileLoadException

An assembly or module was loaded twice with two different evidences.

MissingMethodException

The specified assembly has no entry point.

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.

The following sample demonstrates using one of the overloads of ExecuteAssembly on two different domains.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1
Obsolete (compiler warning) in 4.6
Obsolete (compiler warning) in 4.6
Obsolete (compiler warning) in 4.5
Obsolete (compiler warning) in 4.5.1
Obsolete (compiler warning) in 4.5.2
Obsolete (compiler warning) in 4

.NET Framework Client Profile

Supported in: 3.5 SP1
Obsolete (compiler warning) in 4

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft