以什么顺序搜索位置以加载引用的DLL?

I know that the .NET framework looks for referenced DLLs in several locations

  • Global assembly cache (GAC)
  • Any private paths added to the AppDomain
  • The current directory of the executing assembly

What order are those locations searched? Is the search for a DLL ceased if a match is found or does it continue through all locations (and if so, how are conflicts resolved)?

Also, please confirm or deny those locations and provide any other locations I have failed to mention.


I am not having any real assembly loading problems. I am trying to understand the search/load order from an academic perspective.

And you're right about '%path%'... I had mistaken this from some work with p/invoke calls (I used '%path%' to simplify the 'DllImportAttribute' use).

If a .net dll references a native dll the paths could be used

article does not exist anymore, so we have no idea what the rest of the list is based on your answer

All links are OK on my end.

This seems to be dependant on loading a regular Dll not a .net assembly.