Q:

c# dll binding to different version

I have just restarted a project in which I am using NHibernate. The project worked fine last time I used it but now is giving the following error.

System.IO.FileLoadException: Could not load file or assembly
  'Iesi.Collections, Version=1.0.0.3, Culture=neutral,
  PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The
  located assembly's manifest definition does not match the assembly
  reference. (Exception from HRESULT: 0x80131040) at
  NHibernate.Cfg.Configuration.Reset() at
  NHibernate.Cfg.Configuration..ctor(SettingsFactory settingsFactory) at
  NHibernate.Cfg.Configuration..ctor() at
  Luther.Dao.Repositories.Session.NHibernateHelper..cctor() in
  NHibernateHelper.cs: line 18

I notice the current reference to the iesi.dll is at 1.0.1.0.
What is the best way to get this up and running again? Try and find the appropriate version of the dll or sort out the manifest file? 

A:

Have you updated one of the assemblies in your project since the last time this app ran for you?  It looks like NHibernate was built against version 1.0.0.3, and you currently have 1.0.1.0.
You should be able to use a BindingRedirect element in your App.config (or web.config, as appropriate) to instruct the .Net Framework to satisfy the dependency with a different version.  Something like
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Iesi.Collections" 
                          publicKeyToken="aa95f207798dfdb4"
                          culture="neutral" />
          <bindingRedirect oldVersion="1.0.0.3"
                           newVersion="1.0.1.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

