views:

167

answers:

1
+1  Q: 

dll woes c# noob

Hi, I'm a bit of a visual studio noob. 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 ia 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?

Any pointers much appreciated.

+2  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>
Dathan
You d man man! Seriously though I hadn't been near it for a couple of months. Last time, I opened it it was fine. One of those mysteries. Anyway, thanks - you probably saved me half a day of hair pulling there.
Chin
@Chin No problem. I ran into the same problem a while back - glad to save someone else my pain. (c:
Dathan