views:

997

answers:

4

I have updated the Sharp Architecture solution (SharpArchitecture_1.0_RTM_build_486) (my local copy) and referenced NHibernate 2.1.0.4000 instead of NHibernate 2.1.0.3001 dll. I have also updated all other NHibernate related references in Sharp Architecture solution.

I was able to rebuild Sharp Architecture and to pass all the tests using the NHibernate version 2.1.0.4000. I have used the provide build script.

When I update the references (NHibernate and recompiled Sharp dlls) in my application and try to initialize NHibernate, the application is throwing "Could not load file or assembly 'NHibernate, Version=2.1.0.3001, 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)"

This error is thrown in NHibernateSession.Init method. The calling assembly is SharpArch.Data.

Besides recompiling the Sharp Architecture with new dlls, is there something else that needs to be done? The Sharp Architecture is strongly typed against NHibernate 2.1.0.3001.

The reason why I'm doing this is because I want to include NHibernate.Cache in my application. The NHibernate.Cache is compiled against NHibernate 2.1.0.4000 (NHibernate-2.1.0.GA-bin)

A: 

Try to find and delete all 2.1.0.3001 versions of the DLL from your PC (including versions of the DLL in the GAC) and then recompile / rerun. Hopefully you'll get an error from whatever was trying to reference that version of the DLL and you can update that reference to use the newer 2.1.0.400 version of the DLL.

Michael Maddox
+3  A: 

Add the following within your web.config file before the opening of the system-web tag.

 <runtime>
   <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
       <assemblyIdentity name="NHibernate" publicKeyToken="AA95F207798DFDB4" culture="neutral"/>
    <bindingRedirect oldVersion="0.0.0.0-2.1.0.3001" newVersion="2.1.0.4000"/>
   </dependentAssembly>
 </runtime>

This should solve the problem.

JohnL
This fixed the issue. Thank you.
Srdjan
Glad this helped.
JohnL
Srdjan, could you indicate for future assistance to folks which was the correct answer if in fact the problem is resolved?
JohnL
+1  A: 

A similar question has been asked in the s# group and and by Tom Cabanski

There are name changes that need to be made in both the original S#-Arch source, so you'd need to re-build that too (not just your own solution derived built on the framework).

As of writing these changes are not yet in the trunk so might be worth waiting unless you're really desperate?

rohancragg
There are now forks on GitHub that include integration with the more up-to-date libraries.
rohancragg
A: 

newVersion="2.1.0.4000" should be newVersion="2.1.1.4000"