How to resolve Castle.Windsor and MoQ conflicts for building Castle.Core

In my project I need to use both Castle.Windsor and Moq DLLs. Windsor requires Castle.Core also referenced in the project.

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

Tasks 1: If I use the Moq.dll file from the NET40 folder, I got a "Type. Castle.DynamicProxy.Generators.AttributesToAvoidReplicating" error exists in both "... \ Windsor \ dotNet40 \ Castle.Core.dll" and "... \ MOq \ NET40 \ Moq.dll '"

tasks2: If I use the Moq.dll file from the "NET40-RequiresCastle" folder, which is logical in my situation, I have version conflicts - Moq.dll uses Castle.Core, Version = 2.5.0.0, but Windsor uses Castle.Core, Version = 2.5.1.0

+2
source share
1 answer

The problem can be solved by using assembly bindings - 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>
+8
source

All Articles