Search code examples
c#nhibernatefluent-nhibernatecastle-windsor

Castle.Facilities.NHibernate and FluentNHibernate v2.x


I'm using https://github.com/haf/Castle.Facilities.NHibernate which was built with NHibernate 3.1 and FluentNHibernate 1.2. I've upgraded to NHibernate 4.x and FluentHibernate 2.x via NuGet in my Domain. So that I have these project references:

...
Castle.Facilities.NHibernate v0.7
--> Depends on FLuentNHibernate v1.2
--> Depends on NHibernate v3.1
NHibernate v4.0
FluentNHibernate v2.0
...

WHen upgrading NHibernate and FluentNHibernate I've added these to my app.config:

      <dependentAssembly>
    <assemblyIdentity name="FluentNHibernate" publicKeyToken="8aa435e3cb308880" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-2.0.3.0" newVersion="2.0.3.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.0.0.4000" newVersion="4.0.0.4000" />
  </dependentAssembly>

Castle Facility then properly uses the updated NHibernate version. However, it refuses to use the correct FluentNHibernate version with the following error:

Severity    Code    Description Project File    Line    Suppression State
Error   CS0012  The type 'FluentConfiguration' is defined in an assembly that is not referenced. You must add a reference to assembly 'FluentNHibernate, Version=1.3.0.733, Culture=neutral, PublicKeyToken=8aa435e3cb308880'.  Hl7ic.Domain    ..\FluentInstaller.cs   11  Active

I've read on the FLuentNHibernate page that they do not support strong named. I'm wondering if this is having an affect and I need to recompile one of the above libraries, or if I am missing something else?


Solution

  • Rebuilt latest master of Castle.Facilities.NHibernate with updates and work arounds to the build issues noted in the fork's readme and had the pull request accepted. This fix should be available for all now.

    https://github.com/haf/Castle.Facilities.NHibernate/pull/27