Search code examples
.netnhibernateormcastle-windsorassembly-resolution

NHibernate and Windsor assembly conflicts


I am having an issue getting Hibernate and Windsor to work together. My setup details are as follows

I have two projects
-DomainModel
-MVCApp

I have downloaded NHibernate 2.1.2 and Windsor 2.1.1
I added the following references to DomainModel from the required_Bins folder of the NHibernate download -
Antlr3,Iese,log4net and NHibernate 2.1.2.4
I also added references in DomainModel to files for Lazy_loading including

Castle.Core - 1.1.0.0
Castle.DynamicProxy2 - 2.1.0.0
NHibernate.ByteCode.Castle - 2.1.2.4

The MVCApp has the following references:

Castle.Core - 1.2.0.6623
Castle.Microkernel - 2.1.0.6655
Castle.Windsor - 2.1.0.6655
Castle.DynamicProxy2 - 2.2.0.6628

When running the app I get the Error :

Could not load file or assembly 'Castle.DynamicProxy2, Version=2.1.0.0,
Calling assembly : NHibernate.ByteCode.Castle, Version=2.1.2.4000

The MVC bin folder has the Castle.DynamicProxy2 - 2.2.0.6628 version, hence the error after the older version was requested.

How do I go about getting this to work? What am I missing or including incorrectly? Please help.. Thanks.


Solution

  • From where did you get your NHibernate.ByteCode.Castle?

    I believe that ActiveRecord 2.1 will have one built for the latest stable release of DynamicProxy2.

    Otherwise, do what Lachlan Roche suggests.