NHibernate、NHibernate.Linq 和 FluentNHibernate?投掷错误
我在上一个问题中遇到以下错误:
但是,现在,当我调用该函数时:
LoginRepository login = new LoginRepository();
var allLogins = login.GetAllLogins().ToList();
它会抛出以下错误:
Could not load file or assembly 'NHibernate, Version=2.1.2.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)
问题的根源是 NHibernate.Linq。 FusionLog如下:
=== Pre-bind state information ===
LOG: User = Sean
LOG: DisplayName = NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4 (Fully-specified)
LOG: Appbase = file:///C:/Development/DefaultCollection/Sandboxes/Sean/NHibernateExample/NHibernateExample/
LOG: Initial PrivatePath = C:\Development\DefaultCollection\Sandboxes\Sean\NHibernateExample\NHibernateExample\bin
Calling assembly : NHibernate.Linq, Version=1.1.0.1001, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Development\DefaultCollection\Sandboxes\Sean\NHibernateExample\NHibernateExample\web.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/d33a79ac/1e32c532/NHibernate.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/d33a79ac/1e32c532/NHibernate/NHibernate.DLL.
LOG: Attempting download of new URL file:///C:/Development/DefaultCollection/Sandboxes/Sean/NHibernateExample/NHibernateExample/bin/NHibernate.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
我使用NuGet获取了最新版本的NHibernate、NHibernate.Linq和FluentNHibernate。
有人能引导我走向正确的方向吗?
再次感谢!
I had the following error at previous question:
Fluent NHibernate? Am I doing this correctly?
But, now, when I call the function:
LoginRepository login = new LoginRepository();
var allLogins = login.GetAllLogins().ToList();
It throws an error of:
Could not load file or assembly 'NHibernate, Version=2.1.2.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)
The source of the problem is NHibernate.Linq. The FusionLog is as follows:
=== Pre-bind state information ===
LOG: User = Sean
LOG: DisplayName = NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4 (Fully-specified)
LOG: Appbase = file:///C:/Development/DefaultCollection/Sandboxes/Sean/NHibernateExample/NHibernateExample/
LOG: Initial PrivatePath = C:\Development\DefaultCollection\Sandboxes\Sean\NHibernateExample\NHibernateExample\bin
Calling assembly : NHibernate.Linq, Version=1.1.0.1001, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Development\DefaultCollection\Sandboxes\Sean\NHibernateExample\NHibernateExample\web.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/d33a79ac/1e32c532/NHibernate.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/d33a79ac/1e32c532/NHibernate/NHibernate.DLL.
LOG: Attempting download of new URL file:///C:/Development/DefaultCollection/Sandboxes/Sean/NHibernateExample/NHibernateExample/bin/NHibernate.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
I used NuGet to get the latest versions of NHibernate, NHibernate.Linq, and FluentNHibernate.
Can anyone lead me in the right direction?
Thanks again!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该运行兼容包,您的 NHibernate 版本是 2.1.2.4,这不是最新的。
首先添加对 NHibernate 3.0 的引用,并且 NHibernate.Linq 已过时,因为它属于版本 2,而在版本 3.0 中,Linq 功能位于 NHibernate 程序集本身中
You should run the compatible package, your NHibernate version is 2.1.2.4 which is not the latest one.
First add reference to NHibernate 3.0 , and the NHibernate.Linq is obselete AFAIK, cause it's belong to version 2 and in version 3.0 the Linq functionalitys is in NHibernate assembly itself