views:

38

answers:

2

Not sure where to start, but I had gotten the most recent version of NHibernate, successfully mapped the most simple of business objects, etc. When trying to move to FluentNHibernate and do the same thing, I got this error message on build:

"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."

Background: I'm new to Hibernate, NHibernate, and FluentNHibernate -- but not to .NET, C#, etc.

Database I have a database table called Category:

(PK) CategoryID (type: int), unique, auto-incrementing UserID (type: uniqueidentifier) -- given the value of the user Guid in ASP.NET database Title (type: varchar(50) -- the title of the category

Components involved:

  • I have a SessionProviderClass which creates the mapping to the database
  • I have a Category class which has all the virtual methods for FluentNHibernate to override
  • I have a CategoryMap : ClassMap class, which does the fluent mappings for the entity
  • I have a CategoryRepository class that contains the method to add & save the category
  • I have the TestCatAdd.aspx file which uses the CategoryRepository class.

Would be happy to post code for any of those, but I'm not sure that it's necessary, as I think the issue is that somewhere there's a version conflict between what FluentNHibernate references and the NHibernate I have installed from before.

Thanks in advance for any help you can give!

+2  A: 

There is no such thing as "Moving from NHibernate to FluentNHibernate".

FluentNHibernate is just an addon for NHibernate that provides a slightly different way to create the mappings.

The error message is clear: you are using a version of FluentNHibernate compiled for NHibernate 2.1.0, and you tried to use it with NHibernate 2.1.2, hence the version conflict.

Either download a version of Fluent that uses NH 2.1.2 or compile from source.

Diego Mijelshon
+1  A: 

Thanks all,

The true answer was to remove and re-add the assemblies that came with FluentNHibernate (including the compatible version of NHibernate).

I also had to remember to add the correct references (for example, when using NHibernate, I had not added references to Castle.dll, etc.)

However, this uncovered more problems, which I'll post about in a separate thread.

Thanks!

goober
The problem with that approach is that you are effectively using an outdated version of NHibernate that misses several fixes, just for the sake of using Fluent.
Diego Mijelshon
Fluent NHibernate works with the latest GA release of NHibernate, at the time of our 1.0 release that was 2.1.0 (I believe). The `master` branch is now running on 2.1.2GA, and that's what will be shipped with our imminent 1.1 release.
James Gregory