Error using the most recent version of RestSharp in wp7.

When adding RestSharp via NuGet to WP7 project, you will probably receive the following error:

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


Code sample:

private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            var client = new RestClient("www.google.com");
            var request = new RestRequest("", Method.GET);
        }

Please note that the code sample will not actually work but it is irrelevant.

Solution 1 – downgrading RestSharp

To fix this, uninstall the current version of RestSharp and install previous version (102.5) via the following commands in Package Manager:

Uninstall-Package RestSharp
Install-Package RestSharp -Version 102.5

Solution 2 – downgrading Newtonsoft.Json

Instead of downgrading RestSharp, you can downgrade Newtonsoft.Json. Use the following commands in PackageManager:

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

About programabilan

Profesionalni programer, amaterski programer...

Posted on February 3, 2012, in Errors, WP7 and tagged , , , . Bookmark the permalink. Leave a comment.

Leave a comment