10

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)?

Rangoric
  • 2,739
  • 1
  • 18
  • 18
  • Run into this one as well. According to nuget version number spec newtonsoft.json 4.0.8 should be compatible with 4.0.5. Either RavenDb or Newtonsoft.Json is doing something wrong. Really annoying. – terjetyl Feb 21 '12 at 02:05
  • 1
    Note that RavenDB now supports 4.0.8 – Ayende Rahien Feb 21 '12 at 10:02
  • Thats great ..wait a few days and all your problems are solved :) – dasheddot Feb 21 '12 at 10:05
  • @AyendeRahien Excellent. Still interested in what can be done if this comes up again. I saw the rollback on the 4.0.6 update so figured it might be a bit of time in updating to 4.0.8 (seems I was wrong :) ) – Rangoric Feb 21 '12 at 14:16

2 Answers2

10

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)

dasheddot
  • 2,936
  • 4
  • 26
  • 33
  • 1
    Redirect is quite dengerous. For example when we redicrected to user newver version of Json.NET RavenDb started to miss fields with Guids in documents. – Mike Chaliy Feb 21 '12 at 13:30
  • 1
    I'll have to look at this later, but I can't install both packages. So are you saying NuGet recognizes the redirect and will load packages accordingly? Or is there a certain order I would need to do this? (If this comes up again. – Rangoric Feb 21 '12 at 14:12
3

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.

Daniel Lang
  • 6,819
  • 4
  • 28
  • 54
  • Yeah SignalR is definitely the one I would end up doing locally. – Rangoric Feb 21 '12 at 00:53
  • By compiling it locally, do you mean getting the SignalR source code, changing the reference to Newtonsoft.Json, compiling, then placing the compiled code in your solution? – Bob Horn May 19 '13 at 16:47
  • Yes, that's what I meant back then. However (!) there's no need to deal with that in RavenDB 2.0 anymore since the dependencies to Newtonsoft.Json have been internalized so that there's no conflict anymore! – Daniel Lang May 20 '13 at 15:36