views:

27

answers:

1

I am using the 1.0 RTM of Fluent Nhibernate, with a 3.0 build of NHibernate. In order to do this, I need to add the following to my .config file:

  <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="NHibernate" culture="neutral" publicKeyToken="aa95f207798dfdb4"/>
    <bindingRedirect oldVersion="2.1.0.4000" newVersion="3.0.0.1001"/>
  </dependentAssembly>
</assemblyBinding>

This works great when running integration tests with the TestDriven.net plugin, but fails in the NUnit gui or console runner with the following error:

System.IO.FileLoadException : Could not load file or assembly 'NHibernate, Version=2.1.0.4000, 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)

How do I get NUnit to respect my bindingRedirect and run my integration tests successfully?

+1  A: 

The key is putting it in the correct .config file. See http://stackoverflow.com/questions/465754/does-redirecting-assembly-binding-work-for-unit-testing-with-a-test-runner.

Another approach would be compiling fluent-nhibernate against NHibernate 3.0. If it has compilation errors, ask the dev team and/or fork the source and make it compile.

Mauricio Scheffer