Nuget dependency to Newtonsoft.Json miss the version #187

laurentkempe opened this Issue Nov 24, 2011 · 28 comments


None yet

8 participants


Latest version of Newtonsoft.Json is 4.0.4 and restsharp.nuspec specify it's dependency without a version:

RestSharp 102.5 is compiled against Newtonsoft.Json 4.0.3.

In an application when adding a dependency toward RestSharp 102.5 you will get Newtonsoft.Json is 4.0.4

On a WPF application this works but on a WP7.1 application you will get the following exception

"File or assembly name 'Newtonsoft.Json, Version=, Culture=neutral, PublicKeyToken=30AD4FE6B2A6AEED', or one of its dependencies, was not found."


Added manually a reference to Newtonsoft.Json 4.0.3 to my WP7 project and now everything works fine again.


Had the same issue and had to manually switch to 4.0.3. There must be an easier way.



Uninstall-Package Newtonsoft.Json -Force
Install-Package Newtonsoft.Json -Version 4.0.3

Yeah it the workaround that I used! As you said it is a workaround and when you face the issue it takes some time identify the real issue !

@bkaid bkaid pushed a commit to bkaid/RestSharp that referenced this issue Nov 30, 2011
Brandon Updated Json.NET package to latest version (4.0.4) to fix Issue #187. 04e9e82

Do you plan to push an updated package to Nuget? We're using Selenium.Webdriver that depends on Newtonsoft.Json 4.0.4. Just now, the rest-client cannot load since it tries to look for v4.0.3 of Newtonsoft.Json.


Here is a full dump of the exception message as I found it.

System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
File name: 'Newtonsoft.Json, Version=, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
   at RestSharp.Deserializers.JsonDeserializer.Deserialize[T](RestResponse response)
   at RestSharp.RestClient.Deserialize[T](IRestRequest request, RestResponse raw)

=== Pre-bind state information ===
LOG: DisplayName = Newtonsoft.Json, Version=, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
LOG: Appbase = file:///C:/Users/Nick/AppData/Local/Temp/vrldyzmz.0dx
LOG: Initial PrivatePath = NULL
Calling assembly : RestSharp, Version=, Culture=neutral, PublicKeyToken=null.
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Nick\AppData\Local\Temp\vrldyzmz.0dx\Stripe.Tests.dll.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Newtonsoft.Json, Version=, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
LOG: Attempting download of new URL file:///C:/Users/Nick/AppData/Local/Temp/vrldyzmz.0dx/Newtonsoft.Json.DLL.
LOG: Attempting download of new URL file:///C:/Users/Nick/AppData/Local/Temp/vrldyzmz.0dx/Newtonsoft.Json/Newtonsoft.Json.DLL.
LOG: Attempting download of new URL file:///C:/Users/Nick/AppData/Local/Temp/vrldyzmz.0dx/Newtonsoft.Json.EXE.
LOG: Attempting download of new URL file:///C:/Users/Nick/AppData/Local/Temp/vrldyzmz.0dx/Newtonsoft.Json/Newtonsoft.Json.EXE.

Here is a more concise workaround that doesn't require you to do anything special to the version you are pulling. Add this to your web.config or app.config.

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

This will rebind all references to JSON.NET to and you can update this as you upgrade.


Nick, app.config is not supported in Windows Phone, so assembly redirection won't solve the problem... :\


Agreed :) I'm trying to find a way to circunvey it on Windows Phone - if not, guess I'll go ahead and install the previous version!


Just a small addendum, the problem does not confine to Windows Phone, but to the whole Silverlight apps: AFAIK, there is no way to make assembly redirection in Silverlight, so this is a BIG issue for this platform, and to all libraries around there (like RestSharp or the Cimbalino Toolkit) that depend on :(

RestSharp member

Did it recently become signed? This was never a problem before.


I personally experienced this kind of problems a while a go on RestSharp, as you can see here: #171
More than just my pull request, you can fill a lot more issues and pull requests regarding versions breaking...


This is not a RestSharp issue, so I just added an issue/request on page, please check here:

If you agree with it, please vote and comment and maybe we'll be lucky! :)

RestSharp member

just shipped 102.6 built against 4.0.5.


sigh and the problem is back, just did a NuGet install of 102.6 and it seems there is now a Newton 4.0.7 out. I see that Pedro updated the source but that change hasn't made its way into the official Nuget bits.

RestSharp member

Windows Phone 7.1 (so Mango)


@johnsheehan the problem is the day after you updated the NuGet JSON.NET was released again. It was released twice within two days.

And because of the strong signing of the library each new version has to have a new RestSharp release. If you want to give somebody else, access we could setup a build server to monitor JSON.NET and produce new builds each time. Or we could just ditch JSON.NET for something less likely to break builds like ServiceStack.Text which is not strongly signed.

RestSharp member

I would love to get rid of JSON.NET dependency. If I can do so an make all the current JsonDeserializer tests pass, I will. I don't have any time right now to invest in that though. If someone wants to switch it over to ServiceStack or SimpleJson or something else that won't cause these issues, let's discuss it at


John, why not just add the correct Json dependency version number to the NuGet package? That way, when people install RestSharp thru NuGet, it will always get the correct version of instead of the latest one...
Check here for NuGet dependencies versioning:


That only works for projects that only use RestSharp, if your project uses two packages on NuGet that relay on JSON.NET you are going to have a conflict if the versions don't match. And you will be right back into this dependency hell again.

If this dependency wasn't the 2nd most popular project on NuGet, I would say go for it and see where the chips fall, but there is a huge chance for conflicts with other projects that use JSON.NET.


True, but right now I'm trying to solve RestSharp problem, then we'll get to the other dependencies... ;)


They seem to be one and the same here.


Good news: according to, the next version of will NOT be strongly signed, at least for the Silverlight bits! :)

RestSharp member

102.7 released built against Json.NET 4.0.8. Hopefully this is the last update that needs to be made for this. Download via NuGet or

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment