I am trying to use NuGet to add SignalR and Raven to a new ASP.Net MVC 4 project.
If I do SignalR first, then try to add Raven I get the following error:
Install failed. Rolling back... Install-Package : Already referencing a newer version of 'Newtonsoft.Json'.
If I install Raven first, then SignalR I get:
Install failed. Rolling back... Install-Package : Updating 'Newtonsoft.Json 4.5.7' to 'Newtonsoft.Json 4.5.8' failed. Unable to find a version of 'RavenDB.Client' that is compatible with 'Newtonsoft.Json 4.5.8'.
I thought NuGet was meant to handle this sort of thing?
How can I get them both added?
preguntado el 28 de agosto de 12 a las 10:08
It appears that RavenDB.Client has an exact-version constraint on Newtonsoft.Json = 4.5.7, while SignalR has a more relaxed constraint of '4.5.4 or higher' (actually a constraint imposed by one of its own dependencies, SignalR.Server).
I managed to get your above scenario working with some manual tweaking:
- Created new MVC4 project
- Opened up packages.config and added an 'allowedVersions="[4.5.7]"' attribute to the Newtonsoft.Json package entry
- Opened the package manager console (View... Other windows... Package Manager Console) and ran update-packages to pull in latest code for all default dependencies (takes a while)
- Again in package manager console, ran install-package RavenDB.Client
- Finally in package manager console, ran install-package SignalR
I tried a few combinations of ordering the above but it wasn't liking it - the thing that let it work seems to be the manual editing of packages.config to lock the version of Newtonsoft.Json to 4.5.7 so that subsequent installs don't trash the referenced version.
We ran into this exact issue, but ultimately pulled in the Raven assemblies manually (so we could target a specific version).
Something that we came across is that it is possible to force Nuget to install a package using the command line tools: How to install an older version of package via NuGet?
I ran into the same issue, but instead decided to install an older version of SignalR. Version 4.0 (February 2012) has a dependency on NewtonSoft >= 4.0.7, and this installs correctly with RavenDB already installed:
Install-Package SignalR -Version 0.4.0
I got the same problem with Raven and the standard MVC template. I wanted the latest version of Newtonsoft.Json so I solved it differently. I checked what dependencies RavenDB Client had and then installed the latest version of them first Newtonsoft.Json and NLog I then installed the packet in the Packet manager Console with the -IgnoreDependencies flag.
Install-Package -Id RavenDB.Client -IgnoreDependencies
That worked fine. (I am taking a calculated risk that RavenDB is not compatible with the latest Newtonsoft.Json at the moment. But I am a Daredevil)