In my MVC project, I am trying to use the latest Fluent Nhibernate, and NHibernate.linq. I am using the Nhibernate.dll that came with the latest Fluent Nhibernate released build. However, I have only been able to find NHibernate.linq 1.0.
When attempting to run I get the error:
Could not load file or assembly 'NHibernate, Version=2.1.0.4000, 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 see at SourceForge in the NHibernate project, they have a NHibernate.Linq 2.1.2 version under the NHibernate 2.1.2 project, but if you download this zip, it is empty.
My thoughts is that Linq is referencing the older NHibernate.dll, but how can I get the NHibernate.linq.dll 2.1.2 version?
There is another question with this same error, and I tried all their suggestio开发者_JAVA百科ns with making sure that all the other NHibernate.dll's are included. I didn't rebuild the NHibernate.linq project with the same NHibernate.dll that Fluent uses, since I was hoping to get a newer version of NHibernate.linq.
You can grab a build of NHibernate.Linq compatible with NH2.1.2 from here:
http://sourceforge.net/projects/nhibernate/files/NHibernate/2.1.2GA/NHibernate.Linq-2.1.2-GA-Bin.zip/download
As James wrote, you should download the 2.1.2 zip and extract it with 7-Zip. Version number should be 1.1.0.1001.
However... NHibernate 3.0 is about to be released. It contains an integrated Linq provider which is much more complete, powerful and extensible.
I wouldn't use the old provider (which is not completely compatible with the new one) in a new project.
Try adding the following XML into your Web/App.config file inside the <configuration>
root 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.1.4000" newVersion="2.1.2.4000" />
</dependentAssembly>
</assemblyBinding>
</runtime>
精彩评论