1

I need to reference two versions of the same library (Coherence .NET) in my library project and use them both so I've renamed the dll's and referenced them in my project via aliases, however when I try to compile my library I get this warning

warning MSB3243: No way to resolve conflict between "Coherence, Version=12.1.2.0, Culture=neutral, PublicKeyToken=0ada89708fdf1f9a" and "Coherence, Version=3.3.0.2, Culture=neutral, PublicKeyToken=0ada89708fdf1f9a". Choosing "Coherence, Version=12.1.2.0, Culture=neutral, PublicKeyToken=0ada89708fdf1f9a" arbitrarily

And when I try to register my library (it needs to be registered using RegAsm.exe) I get this erorr

error MSB3217: Cannot register assembly "C:\Program Files\******.dll". Could not load file or assembly 'Coherence, Version=3.3.0.2, Culture=neutral, PublicKeyToken=0ada89708fdf1f9a' or one of its dependencies. The system cannot find the file specified

Two assembly dll's that I've referenced are Coherence.v3.3.dll and Coherence.v12.1.dll

I've tried adding this to my library's App.config but it didn't solved the problem as I'm still getting same error

  <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="Coherence" publicKeyToken="0ada89708fdf1f9a" culture="neutral" />
    <codeBase version="3.3.0.2" href="Coherence.v3.3.dll"/>
    <codeBase version="12.1.2.0" href="Coherence.v12.1.dll"/>
  </dependentAssembly>
</assemblyBinding>
 </runtime>
Troydm
  • 2,642
  • 3
  • 24
  • 35
  • Possible duplicate of [Need a way to reference 2 different versions of the same 3rd party DLL](https://stackoverflow.com/questions/11550981/need-a-way-to-reference-2-different-versions-of-the-same-3rd-party-dll) – Orace Nov 20 '19 at 11:13

2 Answers2

0

As variant, you can create 2 "proxy" assemblies, for each library version.

IL_Agent
  • 707
  • 3
  • 16
0

Edit the project file .csproj and make sure HintPath is present and SpecificVersion=True.

<Reference Include="Coherence, Version=12.1.2.0, ...">
  <HintPath>..\references\******.dll</HintPath>
  <SpecificVersion>True</SpecificVersion>
</Reference>

After that you save the file and again rebuild it.

Earth
  • 3,477
  • 6
  • 37
  • 78
  • When I do that it says warning MSB3245: Could not resolve this reference. Could not locate the assembly "Coherence.v12.1, Version=12.1.2.0, Culture=neutral, PublicKeyToken=0ada89708fdf1f9a, processorArchitecture=MSIL". – Troydm Jun 16 '14 at 10:26
  • For the warning `MSB3245`, you can try C.Evenhuis's answer in this question http://stackoverflow.com/questions/14261412/could-not-resolve-this-reference-could-not-locate-the-assembly – Earth Jun 16 '14 at 10:37
  • his advice doesn't change the fact that when I change to Specific version = true I get yellow icons next to Coherence references and it still says that it can't resolve the dependencies – Troydm Jun 16 '14 at 10:54