What is the .NET folder search hierarchy?

When .NET needs to load an assembly, what is the folder hierarchy it uses to find the assembly? I assume that it starts with the GAC and then the local folder of the executing assembly? What is the complete hierarchy? I know that the Windows search path (for unmanaged code) is something like a local folder / System32 folder / search path, etc. and I'm looking for something similar for .NET.

+4
source share
3 answers

If you were looking for a description of the process, rather than links to lengthy MSDN articles, this is a brief description of the steps . You can find more information here .

The steps to complete the build job are:

  • Determines the correct version of the assembly by examining the applicable configuration files .
  • Checks if the assembly name was bound before and, if so, uses the previously loaded assembly .
  • Checks the GAC .
  • Probes for assembly by following these steps:

    a) If the configuration policy and the publisher do not affect the source link, and if the binding request was created using the Assembly.LoadFrom method, the runtime checks the location hints .

    b) If codebase is in the configuration files, the runtime only checks this location.

    c) Assembly probes using the heuristics described in the probing section. If the assembly is not found after verification, the runtime prompts Windows Installer to ensure the assembly. It acts as an on-demand installation function .

+4
source

Take a look at this article How the Runtime Finds Assemblies .

Actually, this is not a linear way, and it depends on a large number (assembly is already loaded, configuration files, ...), but the article is very clear.

0
source

All Articles