DLL Hell Frustrations

Feb 19, 2011 at 3:27 AM

So the solution to this problem probably ultimately lies with the developers who package their libraries, but here is my experience so far.  I use FluentNHibernate, when you install Fluent, it has a dependency on NHibernate, this automatically downloads NHibernate 3.0, Fluent was built against NHibernate 2.0, so I try to run my application and get an exception, I figure out what is causing it, and decide to go back to NHibernate 2.0, I try to uninstall NHibernate so I can just use my own 2.0 libraries, I am told I can't because it is a dependency for Fluent.  Fine, I uninstall Fluent and NHibernate, add my own NHibernate 2.0 libraries, try to use NuGet to install Fluent, and it overwrites NHibernate 2.0 and reinstalls 3.0.  There has got to be a way to install older versions of files, people aren't always going to want the latest and greatest.

Feb 19, 2011 at 7:37 AM

That's not quite correct. If you install FluentNH, you'll get the latest version (, which is actually built against NH 3.0. The problem is that it was built against a slightly older build of 3.0, causing a binding mismatch.

To fix this, all you should have to do is run the command 'Add-BindingRedirect' (see my post for details). Can you let us know whether that fixes it for you?

Side question: since I really don't know how to use FluentNH, could you give me some minimal code that I can run against it and that would repro what you're seeing?


Feb 19, 2011 at 7:48 AM

As an aside, we're still trying to get a proper owner for FNH. There is actually a newer version available that needs to be packaged and would avoid the need for the binding redirect. Still curious whether adding the redirect makes it work though :)

Feb 19, 2011 at 4:01 PM
Edited Feb 19, 2011 at 4:01 PM

I'll try the redirect on Monday when I'm back at work, what I ended up doing was getting the source code for FluentNHibernate and recompiling it using the latest vesion of NHibernate, then I build a nuget package and put it on my local nuget repository I host for my company.  Other source of frustration was NHibernate.Linq wouldn't work either, but after some reading I found out that NHibernate.Linq is no longer needed for NHibernate 3.0, it is built in, Session.Linq<T>.query calls become Session.Query<T>.query instead and everything was happy.