Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FluentNHibernate and NuGet, problem with NH version

I just updated my project to use NuGet for external references. I added reference to NHibernate, which added all other dependencies for NH. Than I added FluentNHibernate. Versions of NH downloaded for NH and Fluent do not match. NuGet shows version of FNH as 1.1.1.694 as dependent on NH version 3.0.0.0.2001, while NH is showing as version 3.0.0.4000.

When I run the app, I get this message:

Could not load file or assembly 'NHibernate, Version=3.0.0.2001, 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)

I also tried downloading from FNH site, but that shows that is version on FNH is 1.1.0.685 which is dependent on 2.1.2.4000.

Can you fix the NuGet, or should I just use BindingRedirect in config?

like image 906
epitka Avatar asked Jan 23 '11 14:01

epitka


1 Answers

You're in luck! NuGet has a command for just this scenario (which we plan to make more automatic in the future http://blog.davidebbo.com/2011/01/nuget-versioning-part-3-unification-via.html). First build your project and from the package manager console type:

PM> Add-BindingRedirect

And it will add the minimal set of binding redirects to config to get everything working.

like image 84
davidfowl Avatar answered Sep 28 '22 07:09

davidfowl