Search code examples
json.netrestsharpyammer

RestSharp - Could not load file or assembly 'Newtonsoft.Json, Version=4.0.3.0


I'm making a GET request to Yammer.com's REST API using RestSharp (which is awesome), and getting this error:

Could not load file or assembly 'Newtonsoft.Json, Version=4.0.3.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

From debugging, I can see that I'm getting a good response with the Yammer.com messages I'm trying to GET, and the code is throwing the exception on the deserialization.

  • Is this problem related to me writing the deserialization wrong in my code, or to an actual problem with assembly compatibility?
  • How do I fix it?

Solution

  • To anyone still stuck on this. This works today for RestSharp Version 102 (Jan 2012).

    1. Manually delete the projects references to RestShart and newtonsoft JSON
    2. Go download the latest versions of RestSharp and Json.Net manually. Do not use nuget
    3. Manually add references to the dlls you just downloaded to your project