Could not load file or assembly 'Newtonsoft.Json, Version=3.5.0.0

15

I am working in c# 4.0 to read a signed request I am using the following code

FacebookApp fap = new FacebookApp();
fap.AppId = "789485219211963"; // App ID
fap.AppSecret = "365ee9f5823698536767d608cf572a49"; 

string requested_Data = Request.Form["signed_request"];
FacebookSignedRequest fsr = fap.ParseSignedRequest(requested_Data);
IDictionary<string, string> myDic = fsr.Dictionary;

string name = myDic["name"];
string algorithm = myDic["algorithm"];

Response.Write(requested_Data + "<br>" + algorithm + "<br>" + name + "<br>");

But on the highlighted line I received following exception

Could not load file or assembly 'Newtonsoft.Json, Version=3.5.0.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)

I downloaded Newtonsoft.Json. release 1 instead of release 2 but it still not working. Can someone kindly help me to solve this problem, also please guide me either my way of reading signed request is correct or not if not please specify the correct way.

Thanks:

c#
c#-4.0
json.net
asked on Stack Overflow May 30, 2011 by Shahid Rasul • edited Jul 2, 2014 by Owen Blacker

7 Answers

17

I'm guessing you donwloaded Newtonsoft.Json v4.0, not 3.5. Last version of 3.5 is release 8.

http://json.codeplex.com/releases/view/50552

I guess that you might be able to do a version forward in your web.config/app.config in order to use 4.0 instead of 3.5, because some library you are using is probably built against the 3.5 version of Newtonsoft.

answered on Stack Overflow May 30, 2011 by jishi
8

You can update it with its nuget package 'Newtonsoft.Json' using the package manager.

PM> update-package newtonsoft.json
answered on Stack Overflow Mar 19, 2013 by Azadeh Khojandi • edited Sep 16, 2014 by Pero P.
3

In package manager console Visual Studio 2013

PM> Install-Package Newtonsoft.Json

Then restart Visual Studio.

answered on Stack Overflow Jun 13, 2014 by Michael
2

When I ran into this problem, I found that there were 2 similar folders in yourproject/packages, one is version 6.0.5, another is 5.0.6.

I deleted the 5.0.6 and the problem disappeared.

answered on Stack Overflow Apr 15, 2015 by cheny
1

I had the same problem with my Xamarin.Forms PCL WinPhone8.1 project after upgrading all NuGet packages for the solution. The problem was with Newtonsoft.Json v9.0.0 in the winPhone8.1 project.

All other projects worked correctly. Spent two days trawling all advice and finally resolved the problem by deleting the project, pulling a clone of the project from my git and adding back into the solution. Still failed (although the git version worked fine before the commit.)

Deleted reference for Newtonsoft, reinstalled the old version 8.0.3, then upgraded via NuGet to V9.0.0.

Then deleted all references to Newtonsoft from the winPhone8.1 project Bin/ARM/Debug, Bin/x86/Debug and Obj/ARM/Debug/MSIL and MDIL directories. Did a build and SUCCESS.

answered on Stack Overflow Jul 1, 2016 by user3763081
0

PM> update-package newtonsoft.json It works

answered on Stack Overflow Sep 22, 2017 by cryty
0

Open the Package Manager Console and execute the following:

update-package newtonsoft.json 

This worked for me.

answered on Stack Overflow Jun 13, 2018 by Mark • edited Jun 13, 2018 by Aaron Hampton

User contributions licensed under CC BY-SA 3.0