in ASP.NET, IIS

How to force IIS/ASP.NET to use assembly from the bin folder instead of GAC

If you have a assembly with the same version number located both in the bin folder for a web site and in the Global Assembly Cache (GAC), ASP.NET will by default use the GAC version of the file. Sometimes that’s not the ideal solution so here’s a workaround.

1. Open web.config in a text editor

2. Add this code to /configuration/runtime/assemblyBinding/dependentAssembly:

<assemblyIdentity name="Your.Assembly.Name" publicKeyToken="31bf3856ad364e35"/>
<codebase version="1.0.0.0" href="/bin/Your.Assembly.Name.dll" />

Replace Your.Assembly.Name with the correct name of the assembly, insert the public key into the publicKeyToken variable and change the version number to the number used when the assembly was built.

If you don’t have the runtime node specified, here’s how it should look:

...
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Your.Assembly.Name" publicKeyToken="31bf3856ad364e35"/>
	<codebase version="1.0.0.0" href="/bin/Your.Assembly.Name.dll" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
...
</configuration>