AppDomain.Load Method (AssemblyName)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Loads an Assembly given its AssemblyName.

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

public Assembly Load(
	AssemblyName assemblyRef


Type: System.Reflection.AssemblyName

An object that describes the assembly to load.

Return Value

Type: System.Reflection.Assembly

The loaded assembly.

Exception Condition

assemblyRef is null.


assemblyRef is not found.


assemblyRef is not a valid assembly.


Version 2.0 or later of the common language runtime is currently loaded and assemblyRef 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.

This method should be used only to load an assembly into the current application domain. This method is provided as a convenience for interoperability callers who cannot call the static Assembly.Load method. To load assemblies into other application domains, use a method such as CreateInstanceAndUnwrap.

If a version of the requested assembly is already loaded, this method returns the loaded assembly, even if a different version is requested.

Supplying a partial assembly name for assemblyRef is not recommended. (A partial name omits one or more of culture, version, or public key token. For overloads that take a string instead of an AssemblyName object, "MyAssembly, Version=" is an example of a partial name and "MyAssembly, Version=, Culture=neutral, PublicKeyToken=18ab3442da84b47" is an example of a full name.) Using partial names has a negative effect on performance. In addition, a partial assembly name can load an assembly from the global assembly cache only if there is an exact copy of the assembly in the application base directory (BaseDirectory or AppDomainSetup.ApplicationBase).

If the current AppDomain object represents application domain A, and the Load method is called from application domain B, the assembly is loaded into both application domains. For example, the following code loads MyAssembly into the new application domain ChildDomain and also into the application domain where the code executes:

AppDomain ad = AppDomain.CreateDomain("ChildDomain");

The assembly is loaded into both domains because Assembly does not derive from MarshalByRefObject, and therefore the return value of the Load method cannot be marshaled. Instead, the common language runtime tries to load the assembly into the calling application domain. The assemblies that are loaded into the two application domains might be different if the path settings for the two application domains are different.


If both the AssemblyName.Name property and the AssemblyName.CodeBase property are set, the first attempt to load the assembly uses the display name (including version, culture, and so on, as returned by the Assembly.FullName property). If the file is not found, the CodeBase property is used to search for the assembly. If the assembly is found using CodeBase, the display name is matched against the assembly. If the match fails, a FileLoadException is thrown.


for access to read from a file or directory, and for access to the information in the path itself. Associated enumerations: FileIOPermissionAccess.Read, FileIOPermissionAccess.PathDiscovery.

.NET Framework
Available since 1.1
Return to top