NuGet package dependency version problem with NewtonSoft.Json

277 views
Skip to first unread message

Pascal Laurin

unread,
Mar 29, 2011, 11:06:13 AM3/29/11
to rest...@googlegroups.com
Hi,

I've just Install-Package RestSharp from NuGet and noticed a problem with the NewtonSoft package and dll dependency.

First of all, the latest version on RestSharp 101.0 is pulling Newtonsoft.Json version 3.5.8 rather than 4.0.1.  So the dll added to my project is called Newtonsoft.Json.dll version 3.5 where as RestSharp depends on Newtonsoft.Json.Net35.dll version 4.0.

Now when I try to deserialize json I get "Could not load file or assembly 'Newtonsoft.Json.Net35, Version=4.0.0.0 ..." in the ErrorMessage property of the RestResponse instance I get from calling RestClient.Execute<T>( ).

Current work around is to download Json.Net 4.0 release 1 from CodePlex and manually replace the reference in the project.

I don't know much about NuGet package configuration but I'm guessing it's an easy fix.

Thanks.


John Sheehan

unread,
Mar 31, 2011, 3:02:32 PM3/31/11
to rest...@googlegroups.com
You can also get around this by removing the Newtonsoft.Json reference
and adding it back by browsing to the packages/Newtonsoft.Json/3.5
folder and adding that.

The problem is that the download and the nuget package use different
assembly names. I just need to update the RestSharp project to use a
NuGet reference to JSON.NET directly, which I can do now that
framework profiles are supported once the JSON.NET package is updated
to support them as well.

DennisH

unread,
Apr 22, 2011, 1:25:27 PM4/22/11
to RestSharp
I was having the same issue(s) as Pascal. I installed the latest
RestSharp 101.1 via NuGet this morning and seems to be working fine
for me. Thanks John.

-Dennis

John Sheehan

unread,
Apr 24, 2011, 10:45:21 PM4/24/11
to rest...@googlegroups.com
Thanks for the report. I'm still getting the issue with 101.1 and am
working to resolve it.

If anyone is interested in helping narrow it down, create a new
project (MVC, Console, etc), add RestSharp via NuGet then try to
retrieve some JSON using Execute<T> and let me know if you get an
exception.

David Poulin

unread,
Apr 25, 2011, 2:58:37 AM4/25/11
to rest...@googlegroups.com
Hi John (^__^)

I tried to create a console application and add restsharp via NuGet. I got the same exception than Pascal. Everything was good on installation.

PM> Install-Package RestSharp
'Newtonsoft.Json' not installed. Attempting to retrieve dependency from source...
Done.
Successfully installed 'Newtonsoft.Json 4.0.2'.
Successfully installed 'RestSharp 101.1'.
Successfully added 'Newtonsoft.Json 4.0.2' to TestRestsharpNuget.
Successfully added 'RestSharp 101.1' to TestRestsharpNuget.



2011/4/25 John Sheehan <johns...@gmail.com>
Reply all
Reply to author
Forward
0 new messages