NHibernate,NHibernate.Linq和FluentNHibernate吗?抛出错误

问题描述

| 我在上一个问题中遇到以下错误: 流利的NHibernate?我这样做正确吗? 但是,现在,当我调用该函数时:
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,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,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,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。 谁能引导我正确的方向? 再次感谢!     

解决方法

您应该运行兼容的软件包,您的NHibernate版本是2.1.2.4,而不是最新版本。 首先添加对NHibernate 3.0的引用,并且NHibernate.Linq是过时的AFAIK,因为它属于版本2,而在版本3.0中,Linq功能位于NHibernate程序集本身中     

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...