Source: https://msdn.microsoft.com/en-us/library/yx7xezcf(v=vs.110).aspx

The binding information can be viewed with fuslogvw.exe (Assembly Binding Log Viewer).

The preferred way of referencing an assembly is to use a full reference: include assembly name, version, culture and public key token.

An assembly can be referenced statically (from an assembly metadata) or dynamically (via Assembly.Load and variants).

Note: when calling Assembly.Load or AppDomain.Load and specifying only the assembly name only the application directory is searched for the assembly and no other checking occurs.

Another way of making a dynamic reference is to call Assembly.Load and provide only partial information; the reference is qualified via the <qualifyAssembly> element in the application configuration file. Using qualifyAssembly asks the runtime to search for an assembly in the GAC.

Resolving an assembly reference:

  • determine correct assembly version
  • check whether the assembly name has been bound before and, if so, use the previously loaded assembly; if the previous request has failed the current request fails immediately without attempting to load the assembly
  • check GAC; if the assembly exists there, the runtime uses this assembly
  • probe for the assembly

 

Determine the correct assembly version:

  • examine configuration files (application configuration file, publisher policy file, machine configuration file)

Probe for the assembly:

  • use codeBase element (if codeBase exists and the assembly is missing, binding fails)
  • use application base, culture, name, privatePath (if exists)

Probed directories with no culture specified:

[application base]/[assembly name].dll

[application base]/[assembly name]/[assembly name].dll

If culture has been specified:

[application base]/[culture]/[assembly name].dll

[application base]/[culture]/[assembly name]/[assembly name].dll

If privatePath is specified and a culture is specified:

[application base]/[binpath]/[culture]/[assembly name].dll

[application base]/[binpath]/[culture]/[assembly name]/[assembly name].dll

If privatePath is specified and a culture is not specified:

[application base]/[binpath]/[assembly name].dll

[application base]/[binpath]/[assembly name]/[assembly name].dll

 

Advertisements