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 188.8.131.5200” is requested by the runtime, the assembly “NHibernate, version 184.108.40.20600″ will be loaded and used instead without throwing an exception of type:
Could not load file or assembly 'NHibernate, Version=220.127.116.1100, 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="18.104.22.16800" newVersion="22.214.171.12400"/> </dependentAssembly> </assemblyBinding> </runtime> </configuration>