views:

837

answers:

2

How to get Fluent NHibernate working with latest NHibernate 3.x trunk

I got the following Exception :

Could not load file or assembly 'NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies.

EDIT :

This exception occurs in FluentNhibernate file PersistanceConfiguration

    public TThisConfiguration Cache(Action<CacheSettingsBuilder> cacheExpression)
    {
        cacheExpression(cache);
        return (TThisConfiguration)this;
    }

Don't understand, FluentNHibernate is well compiled against NH 3.x

+3  A: 

You will need to build a version of FluentNHibernate against your NHibernate 3.x assembly.

Download the Fluent sources from the github link on their download page. The included project file references a NH 2.1, so you would need to update the references in the project.

Lachlan Roche
@Lachlan : I already did ... but still assembly load exception. I'm using it on an ASP.NET MVC web site. Maybe i need to clear ASP.NET temporary files ?
Yoann. B
@Lachlan : cleared asp.net temporary files, exception still here
Yoann. B
@Yoann Check the references of your fluent dll in reflector. If this shows NH 3.x, then something else is trying to load 2.1 - possibly from a web.config entry.
Lachlan Roche
@Lachlan : References in FluentNhib are NH 3.x, however execption thrown into FluentNHibernate.cfg.Db.PersistenceConfirguration at line 190 public TThisConfiguration Cache(Action<CacheSettingsBuilder> cacheExpression) { cacheExpression(cache); return (TThisConfiguration)this; }
Yoann. B
@Yoann I think you might have a NH cache provider from NH2.1
Lachlan Roche
@Lachlan : You right ! Now i' getting exception from NHibernate.Search, i'm going to rebuild it against NH 3.x. Thanks.
Yoann. B
+2  A: 

I'd grab it from hornget:

http://hornget.net/packages/orm/

this will include all of the dependancies also so you don't need to mess about with compiling all the projects and their dependancies :)

cvista
unfortunately hornget is gone...
kay.herzam