NHibernate 和 Windsor 程序集冲突

发布于 2024-08-23 13:07:16 字数 822 浏览 6 评论 0原文

我在让 Hibernate 和 Windsor 协同工作时遇到问题。我的设置详细信息如下

我有两个项目
-域模型
-MVC应用程序

我已经下载了 NHibernate 2.1.2 和 Windsor 2.1.1
我从 NHibernate 下载的 required_Bins 文件夹中添加了对 DomainModel 的以下引用 -
Antlr3、Iese、log4net 和 NHibernate 2.1.2.4
我还在 DomainModel 中添加了对 Lazy_loading 文件的引用,包括

Castle.Core - 1.1.0.0
Castle.DynamicProxy2 - 2.1.0.0
NHibernate.ByteCode.Castle - 2.1.2.4
< br> MVCApp 有以下参考:

Castle.Core - 1.2.0.6623
Castle.Microkernel - 2.1.0.6655
温莎城堡 - 2.1.0.6655
Castle.DynamicProxy2 - 2.2.0.6628

运行应用程序时出现错误:

无法加载文件或程序集“Castle.DynamicProxy2,版本=2.1.0.0,
调用程序集:NHibernate.ByteCode.Castle,版本=2.1.2.4000

MVC bin 文件夹具有 Castle.DynamicProxy2 - 2.2.0.6628 版本,因此请求旧版本后会出现错误。

我该如何让它发挥作用?我遗漏了什么或错误包含了什么?请帮忙..谢谢。

I am having an issue getting Hibernate and Windsor to work together. My setup details are as follows

I have two projects
-DomainModel
-MVCApp

I have downloaded NHibernate 2.1.2 and Windsor 2.1.1

I added the following references to DomainModel from the required_Bins folder of the NHibernate download -
Antlr3,Iese,log4net and NHibernate 2.1.2.4
I also added references in DomainModel to files for Lazy_loading including

Castle.Core - 1.1.0.0
Castle.DynamicProxy2 - 2.1.0.0
NHibernate.ByteCode.Castle - 2.1.2.4

The MVCApp has the following references:

Castle.Core - 1.2.0.6623
Castle.Microkernel - 2.1.0.6655
Castle.Windsor - 2.1.0.6655
Castle.DynamicProxy2 - 2.2.0.6628

When running the app I get the Error :

Could not load file or assembly 'Castle.DynamicProxy2, Version=2.1.0.0,
Calling assembly : NHibernate.ByteCode.Castle, Version=2.1.2.4000

The MVC bin folder has the Castle.DynamicProxy2 - 2.2.0.6628 version, hence the error after the older version was requested.

How do I go about getting this to work? What am I missing or including incorrectly? Please help.. Thanks.

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

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

发布评论

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

评论(4

半衬遮猫 2024-08-30 13:07:16

你从哪里得到你的NHibernate.ByteCode.Castle?

我相信 ActiveRecord 2.1 将为 DynamicProxy2 的最新稳定版本构建一个。

否则,请按照 Lachlan Roche 的建议进行操作。

From where did you get your NHibernate.ByteCode.Castle?

I believe that ActiveRecord 2.1 will have one built for the latest stable release of DynamicProxy2.

Otherwise, do what Lachlan Roche suggests.

_失温 2024-08-30 13:07:16

您可以获取 NHibernate.ByteCode.Castle 的源代码并构建一个使用 Castle.DynamicProxy2 版本 2.2.0.6628 的版本。 2.1.x 分支位于 svn 中的此处

程序集绑定重定向也可能起作用。由于 Castle.DynamicProxy2 2.1 和 2.2 之间的 API 差异,这可能会失败。
您还可以更新 MVCApp 项目中的程序集引用。

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentAssembly>
            <assemblyIdentity name="Castle.DynamicProxy2" publicKeyToken="407dd0808d44fbdc"/>
            <bindingRedirect oldVersion="2.1.0.0" newVersion="2.2.0.6628"/>
         </dependentAssembly>
      </assemblyBinding>
   </runtime>
</configuration>

You could get the source for NHibernate.ByteCode.Castle and build a version that uses version 2.2.0.6628 of Castle.DynamicProxy2. The 2.1.x branch is here in svn.

It is also possible that an assembly binding redirect may work. This could fail due to API difference between 2.1 and 2.2 of Castle.DynamicProxy2.
You would also update the assembly references in your MVCApp project.

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentAssembly>
            <assemblyIdentity name="Castle.DynamicProxy2" publicKeyToken="407dd0808d44fbdc"/>
            <bindingRedirect oldVersion="2.1.0.0" newVersion="2.2.0.6628"/>
         </dependentAssembly>
      </assemblyBinding>
   </runtime>
</configuration>
半﹌身腐败 2024-08-30 13:07:16

我遇到了这个问题,您可能需要将项目属性的应用程序选项卡上的“目标框架”从“.NET Framework 4 Client Profile”更改为“.NET Framework 4”

I had this issue, you may have to change your "Target framework" on the application tab of your project properties from ".NET Framework 4 Client Profile" to ".NET Framework 4"

锦欢 2024-08-30 13:07:16

我遇到了同样的问题......我通过 更改 NHibernate 字节码提供程序
当我开始使用 NHibernate 时,我选择了 Castle Bytecode 提供程序,没有任何特定原因。

因为我不关心实际使用哪个字节码提供程序,所以我只是更改了它(在我的例子中为 NHibernate.ByteCode.LinFu)。
因此 NHibernate 不再需要任何对 Castle 的引用,我可以使用我想要的任何版本的 Windsor。

I had the same problem...and I solved it by changing the NHibernate Bytecode provider.
When I started using NHibernate, I chose the Castle Bytecode provider for no specific reason.

Since I don't care which Bytecode provider I actually use, I just changed it (in my case to NHibernate.ByteCode.LinFu).
So NHibernate doesn't need any references to Castle anymore, and I can use whatever version of Windsor I want.

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