<p>I know that the .NET framework looks for referenced DLLs in several locations</p>

<ul>
<li>Global assembly cache (GAC)</li>
<li>Any private paths added to the AppDomain</li>
<li>The current directory of the executing assembly</li>
</ul>

<p>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)?</p>

<p><em>Also, please confirm or deny those locations and provide any other locations I have failed to mention.</em></p>

[{'answer_id': 50001, 'author': 'Anders Sandvig', 'author_id': 1709, 'author_profile': 'https://Stackoverflow.com/users/1709', 'pm_score': 2, 'selected': False, 'text': '<blockquote>\n<p>No longer is the current directory searched first when loading DLLs! This change was also made in Windows XP SP1. The default behavior now is to look in all the system locations first, then the current directory, and finally any user-defined paths.</p>\n</blockquote>\n<p>(ref. <a href="http://weblogs.asp.net/pwilson/archive/2003/06/24/9214.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/pwilson/archive/2003/06/24/9214.aspx</a>)</p>\n<p>The default search order, which can be changed by the application, is also described on MSDN: <a href="https://learn.microsoft.com/en-gb/windows/win32/dlls/dynamic-link-library-search-order" rel="nofollow noreferrer">Dynamic-Link Library Search Order</a>.</p>\n'}, {'answer_id': 50052, 'author': 'Anthony Mastrean', 'author_id': 3619, 'author_profile': 'https://Stackoverflow.com/users/3619', 'pm_score': 3, 'selected': False, 'text': '<p>I found <a href="http://nerddawg.blogspot.com/2005/11/dll-search-order-during-loading.html" rel="noreferrer">an article</a> referencing the MSDN article on <a href="http://msdn.microsoft.com/en-us/library/ms682586.aspx" rel="noreferrer">DLL search order</a> that says</p>\n\n<blockquote>\n  <p>For managed code dependencies, the\n  Global Assembly Cache always prevails;\n  the local assembly in application\n  directory will not be picked up if\n  there is an existing (or newer with\n  policy) copy in the GAC.</p>\n</blockquote>\n\n<p>Considering this, I guess the MSDN list is correct with one addition</p>\n\n<pre>0. Global assembly cache</pre>\n'}, {'answer_id': 50058, 'author': 'Lars Truijens', 'author_id': 1242, 'author_profile': 'https://Stackoverflow.com/users/1242', 'pm_score': 7, 'selected': True, 'text': '<p>Assembly loading is a rather elaborate process which depends on lots of different factors like configuration files, publisher policies, appdomain settings, CLR hosts, partial or full assembly names, etc.</p>\n<p>The simple version is that the GAC is first, then the private paths. %PATH% is never used.</p>\n<p>It is best to use <a href="https://learn.microsoft.com/en-us/dotnet/framework/tools/fuslogvw-exe-assembly-binding-log-viewer" rel="nofollow noreferrer">Assembly Binding Log Viewer (Fuslogvw.exe)</a> to debug any assembly loading problems.</p>\n<p><strong>EDIT</strong>\n<a href="https://learn.microsoft.com/en-us/dotnet/framework/deployment/how-the-runtime-locates-assemblies" rel="nofollow noreferrer">How the Runtime Locates Assemblies</a> explains the process in more detail.</p>\n'}]
['https://Stackoverflow.com/questions/49972', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3619/']