Export (0) Print
Expand All

Assembly.LoadFile Method (String, Evidence)

Loads an assembly given its path, loading the assembly into the domain of the caller using the supplied evidence.

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)

public static Assembly LoadFile (
	string path,
	Evidence securityEvidence
)
public static Assembly LoadFile (
	String path, 
	Evidence securityEvidence
)
public static function LoadFile (
	path : String, 
	securityEvidence : Evidence
) : Assembly

Parameters

path

The path of the assembly file.

securityEvidence

Evidence for loading the assembly.

Return Value

The loaded assembly.

Exception typeCondition

ArgumentNullException

The path parameter is a null reference (Nothing in Visual Basic).

FileNotFoundException

The path parameter is the empty string ("") or does not exist.

FileLoadException

A file that was found could not be loaded.

BadImageFormatException

path is not a valid assembly.

Use the LoadFile method to load and examine assemblies that have the same identity, but are located in different paths. LoadFile does not load files into the LoadFrom context, and does not resolve dependencies using the load path, as the LoadFrom method does. LoadFile is useful in this limited scenario because LoadFrom cannot be used to load assemblies that have the same identities but different paths; it will load only the first such assembly.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1

Community Additions

ADD
Show:
© 2015 Microsoft