Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RavenDB and SignalR Nuget Package Dependency Conflict

Basic conflict.

SignalR wants Newtonsoft.Json version 4.0.7 or higher while RavenDB wants version equal to 4.0.5. Which obviously means they can't be installed side by side.

So aside from downloading the source code from one of them and getting the dependencies figured out locally then have to check in the binary created from that, is there a possible way to keep the dependencies managed with NuGet, and maybe just forward the DLL Calls (like Mvc does with each new version for example)?

like image 379
Rangoric Avatar asked Feb 20 '12 23:02

Rangoric


2 Answers

We were running into the same issue a few days ago and this is a nasty one. We found that you can't keep the dependencies managed with NuGet. Instead, we have changed SignalR to use 4.0.5 and compiled it locally.

like image 35
Daniel Lang Avatar answered Oct 14 '22 20:10

Daniel Lang


There is even a more appropriate way to work around this conflict. Since .NET gives us the possiblity to redirect assemblies, why not use it ;)

You can just add something like that to your App.config (take care if there is already an assemblyBinding placed):

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
         <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
         <bindingRedirect oldVersion="0.0.0.0-4.0.8.0" newVersion="4.0.5.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

With this redirect set you can simply add the RavenDB package and the SignalR package (each of them referring to an other version of JSON.NET) and it does the fix.

Additionally i did an pull request on SignalR to request support for JSON.NET in version 4.0.5 too (since it should be backward compatible)

like image 51
dasheddot Avatar answered Oct 14 '22 18:10

dasheddot