System.Reflection.Assembly.Load Method

Loads an assembly given the long form of its name.

Syntax

public static Assembly Load (string assemblyString)

Parameters

assemblyString
The long form of the assembly name.

Returns

The loaded assembly.

Exceptions

TypeReason
ArgumentNullException assemblyString is null.
ArgumentException assemblyString is equal to string.Empty or starts with the null character ('\0').
System.IO.FileNotFoundExceptionThe System.Reflection.Assembly identified by assemblyString was not found.
BadImageFormatExceptionThe System.Reflection.Assembly identified by assemblyString is not a valid assembly.

Remarks

System.IO.FileLoadException is thrown if assemblyString specifies the full assembly name, and the first assembly that matches the simple name has a different version, culture, or public key token. The loader does not continue probing for other assemblies that match the simple name.

Whether certain permissions are granted or not granted to an assembly is based on evidence. The rules for assembly and security evidence merging are as follows:

Reflecting on C++ executable files might throw a BadImageFormatException. This is most likely caused by the C++ compiler stripping the relocation addresses or the .reloc section from your executable file. To preserve the .reloc address for your C++ executable file, specify /fixed:no when you are linking.

In the .NET Framework version 2.0, processor architecture is added to assembly identity, and can be specified as part of assembly name strings. For example, "ProcessorArchitecture=msil". However, the recommended way to specify an assembly name is to create an System.Reflection.AssemblyName object and pass it to an appropriate overload of the erload:System.Reflection.Assembly.Load method. See AssemblyName.ProcessorArchitecture.

Requirements

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0