加载 NHibernate 相关 dll 之一时出错

发布于 2024-11-27 14:57:16 字数 1734 浏览 1 评论 0原文

我正在使用 NHibernate 构建一个应用程序。因为我无法添加当前版本的 NHibernate 的 DLL(当目标框架为 4.0 时,我无法添加引用)。

我试图获取最新和最好的www,这就是我现在拥有的:

  • 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 的复制/加载存在一些问题,因此我将它们设为部署项目。 但运行时我(仍然)得到以下结果:

NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException:在配置代理工厂类期间无法加载类型“NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle”。 可能的原因有: - NHibernate.Bytecode 提供程序集未部署。 - 用于初始化会话工厂部分的“proxyfactory.factory_class”属性的 typeName 格式不正确。

解决方案

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

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

有人想吗?

为了回应 Vijay Gill 的回答,我决定采取不同的策略。

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

有一个 FluentNHibernate 包。我已经安装了它,但我想这里也有问题:

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

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”或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。

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)

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: 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.

Solution:

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

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.

Thoughts anyone?

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

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

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

Test method CoreDatabaseTests.CreateCoreDatabase threw exception:

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

眼中杀气 2024-12-04 14:57:16

使用 NHibernate 3.2,您不再需要 NHibernate.ByteCode.Castle,这大大简化了您的依赖关系树。

With NHibernate 3.2 you don't need NHibernate.ByteCode.Castle anymore, which considerably simplifies your dependency tree.

打小就很酷 2024-12-04 14:57:16

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

我建议您下载 Fluent NH 并坚持使用该版本或者如果您想处于最前沿,请下载 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.

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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文