Sometimes when the runtime of an application requests a specific version (process named assembly binding) of a DLL it is required to force the use of another version of that same DLL.
In the sample presented next, each time the assembly “NHibernate, version 126.96.36.19900” is requested by the runtime, the assembly “NHibernate, version 188.8.131.5200″ will be loaded and used instead without throwing an exception of type:
Could not load file or assembly 'NHibernate, Version=184.108.40.20600, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Excerpt of the “Web.Config” file:
<configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" /> <bindingRedirect oldVersion="220.127.116.1100" newVersion="18.104.22.16800"/> </dependentAssembly> </assemblyBinding> </runtime> </configuration>