加载NHibernate依赖的dll之一时出错

编程入门 行业动态 更新时间:2024-10-27 08:26:18
本文介绍了加载NHibernate依赖的dll之一时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用NHibernate构建应用程序.因为我无法添加当前版本的NHibernate的DLL(当以Framework 4.0为目标时,我无法添加引用.)

I am building an application using NHibernate. Because I could not add the DLL's of my current version of NHibernate (I cannot add reference when framework 4.0 is target).

我试图获得最新和最好的世界,这就是我现在所拥有的:

I tried to get the latest and greatest of the w.w.w., this is what I have now:

  • NHibernate.dll(3.2.0.4000)
  • NHibernate.ByteCode.Castle(3.0.0.4000)
  • FluentNHibernate.dll(1.2.0.694)
  • Castle.Core(2.5.2.0)
  • Castle.Services.Logging.NLogIntegration(2.5.2.0)
  • Antlr.Runtim(3.1.3.42154)
  • Iesi.Collections(3.2.0.400)

这些我可以参考并构建我的解决方案.我知道dll.s的复制/加载过程中存在一些问题,因此我将它们作为部署项. 但是运行时(仍然)得到以下信息:

These I can reference and build my solution with. I know there are some issues with the copying/loading of the dll.s so I made them deployment items. But run-time I (still) get the following:

NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException:无法在配置代理工厂类的过程中加载类型"NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle". 可能的原因是: -未部署NHibernate.Bytecode提供程序程序集. -用于初始化session-factory部分的'proxyfactory.factory_class'属性的typeName格式不正确.

NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException: Unable to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle' during configuration of proxy factory class. Possible causes are: - The NHibernate.Bytecode provider assembly was not deployed. - The typeName used to initialize the 'proxyfactory.factory_class' property of the session-factory section is not well formed.

解决方案:

确认您的部署文件夹包含以下程序集之一:

Confirm that your deployment folder contains one of the following assemblies:

NHibernate.ByteCode.LinFu.dll NHibernate.ByteCode.Castle.dll ---> System.TypeLoadException:程序集'NHibernate.ByteCode.Castle'中'NHibernate.ByteCode.Castle.ProxyFactoryFactory'类型的方法'IsProxy',Version = 3.0.0.4000,Culture = neutral,PublicKeyToken = aa95f207798dfdb4'没有实现.

NHibernate.ByteCode.LinFu.dll NHibernate.ByteCode.Castle.dll ---> System.TypeLoadException: Method 'IsProxy' in type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory' from assembly 'NHibernate.ByteCode.Castle, Version=3.0.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' does not have an implementation.

有没有人?

针对维杰·吉尔(Vijay Gill)的回答,我决定采用其他方法.

In response to Vijay Gill’s answer I have decided to take a different tack.

NUGet软件包,一站式商店和轻松更新!

NUGet packages, a one-stop shop, and easy updates!

那里有一个FluentNHibernate软件包.我已经安装了它,但我想这里也有些不对劲:

There is a FluentNHibernate package out there. I have installed it but I guess there is something amiss here too:

测试方法CoreDatabaseTests.CreateCoreDatabase抛出异常:

Test method CoreDatabaseTests.CreateCoreDatabase threw exception:

System.IO.FileLoadException:无法加载文件或程序集"NHibernate,Version = 3.2.0.4000,Culture = neutral,PublicKeyToken = aa95f207798dfdb4"或其依赖项之一.找到的程序集的清单定义与程序集引用不匹配. (来自HRESULT的异常:0x80131040)---> System.IO.FileLoadException:无法加载文件或程序集"NHibernate,Version = 3.1.0.4000,Culture = neutral,PublicKeyToken = aa95f207798dfdb4"或其依赖项之一.找到的程序集的清单定义与程序集引用不匹配.

System.IO.FileLoadException: Could not load file or assembly 'NHibernate, Version=3.2.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) ---> System.IO.FileLoadException: Could not load file or assembly 'NHibernate, Version=3.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

推荐答案

在这种情况下,从各个位置获取组件并不是一个好主意,您可以从头开始编译所有内容.到目前为止,这是我的经验. Fluent NH尚未更新为NH 3.2GA.

Getting components from various locations in such cases is nto a good idea, you compile everything from scratch. Well that's my experience so far. Fluent NH has not been updated to NH 3.2GA.

我建议您下载流利的NH 并坚持使用附带的版本,或者如果您想使用最新版本,请下载流利的NH的来源,并使用设置为最新NH(3.2GA)的参考进行编译.

I would suggest you to download fluent NH and stick with the version that comes with it OR if you want to be on the bleeding edge, download the sources of fluent NH and compile with references set to latest NH (3.2GA).

更多推荐

加载NHibernate依赖的dll之一时出错

本文发布于:2023-07-22 10:40:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1186773.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:加载   NHibernate   dll

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!