17
votes

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?

1
Personally I've given up on NuGet, the repositories are all over the place and out of date.Phill
@Phil: Really? I just made a switch thinking it would be easier to manage my dependenciesepitka
Most packages are up to date. Some don't have official owners quite yet, but this is quickly changing as adoption grows.David Ebbo

1 Answers

18
votes

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.