如何解决Castle.Core程序集的Castle.Windsor和MoQ版本冲突

编程入门 行业动态 更新时间:2024-10-28 08:22:48
本文介绍了如何解决Castle.Core程序集的Castle.Windsor和MoQ版本冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在我的项目中,我需要同时使用Castle.Windsor和Moq dll.温莎要求在项目中也引用Castle.Core.

In my project I need to use simultaneously Castle.Windsor and Moq dlls. Windsor requires Castle.Core also to be referenced in the project.

当我尝试使用Castle.Core中的方法时,问题开始了: Castle.DynamicProxy.Generators.AttributesToAvoidReplicating.Add(...);

Problem starts when I try to use methods from Castle.Core: Castle.DynamicProxy.Generators.AttributesToAvoidReplicating.Add(...);

问题1: 如果我从NET40文件夹中使用Moq.dll,则会生成错误消息"... \ Windsor \ dotNet40 \ Castle.Core.dll"和"... \中都存在类型'Castle.DynamicProxy.Generators.AttributesToAvoidReplicating'. MoQ \ NET40 \ Moq.dll'"

Problem1: If I use Moq.dll from NET40 folder, I got built error "The type 'Castle.DynamicProxy.Generators.AttributesToAvoidReplicating' exists in both '...\Windsor\dotNet40\Castle.Core.dll' and '...\MoQ\NET40\Moq.dll'"

问题2: 如果我在逻辑上根据情况从"NET40-RequiresCastle"文件夹中使用Moq.dll,则发生版本冲突-Moq.dll使用Castle.Core,版本= 2.5.0.0,而Windsor使用Castle.Core,版本= 2.5 .1.0

Problem2: If I use Moq.dll from "NET40-RequiresCastle" folder, which is logically in my situation, I got versions conflict - Moq.dll uses Castle.Core, Version=2.5.0.0, but Windsor uses Castle.Core, Version=2.5.1.0

推荐答案

可以使用程序集绑定解决问题- App.config:

Problem can be solved using assembly binding - App.config:

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" /> <bindingRedirect oldVersion="1.0.0.0-2.5.0.0" newVersion="2.5.1.0" /> </dependentAssembly> </assemblyBinding>

更多推荐

如何解决Castle.Core程序集的Castle.Windsor和MoQ版本冲突

本文发布于:2023-11-16 06:31:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1601846.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何解决   冲突   版本   程序   Castle

发布评论

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

>www.elefans.com

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