Assembly.LoadFile Method (String, Evidence)
Loads an assembly given its path, loading the assembly into the domain of the caller using the supplied evidence.
Assembly: mscorlib (in mscorlib.dll)
[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlEvidence)] public static Assembly LoadFile( string path, Evidence securityEvidence )
- Type: System.String
The path of the assembly file.
- Type: System.Security.Policy.Evidence
Evidence for loading the assembly.
Return ValueType: System.Reflection.Assembly
The loaded assembly.
The path parameter is null.
The path parameter is an empty string ("") or does not exist.
A file that was found could not be loaded.
path is not a valid assembly.
Version 2.0 or later of the common language runtime is currently loaded and path was compiled with a later version.
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.
to load an assembly with evidence. Associated enumeration: SecurityPermissionFlag.ControlEvidence.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.