Force load an assembly from the /bin and not the GAC?

No there is no way to do this. When loading an assembly the CLR will check to see if a DLL with an equivalent strong name is present in the GAC. If there is a matching assembly in the GAC it will pick the GAC assembly every time. There is unfortunately no way to override this behavior.


I found another way. It is only meant for developers, but it works. According to https://msdn.microsoft.com/en-us/library/cskzh7h6(v=vs.100).aspx you set this in the your .config file

<configuration>
  <runtime>
    <developmentMode developerInstallation="true"/>
  </runtime>
</configuration>

You also need to set the Environment variable DEVPATH with to the path of your dll. Open a cmd, set the variable, run your app:

SET DEVPATH=YOURLOCALPATH

This helped me to load a local Oracle.ManagedDataAccess.dll since Oracle releases new versions, but they all have the same Version and PublicKeyToken. Thanks Oracle!

You can use Process Explorer from Microsoft to see the difference. See https://technet.microsoft.com/en-us/sysinternals/ See this as a small proof of concept: Process Explorer screenshot


GAC is always tried first, when binding assemblies: How the Runtime Locates Assemblies

So no, you can't do this. However if you explain why you have such strange requirements there might be a different work around, you have not thought of.


It is possible, but it is advanced and require your knownledge on CLR and how it works and C++.

Take a look at this google book:Customizing the Microsoft® .NET Framework Common Language Runtime

Keywords: IHostAssemblyManager, IHostAssemblyStore