Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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:

like image 256
Shahid Rasul Avatar asked May 30 '11 13:05

Shahid Rasul


3 Answers

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.

like image 128
jishi Avatar answered Nov 04 '22 08:11

jishi


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

PM> update-package newtonsoft.json
like image 22
Azadeh Khojandi Avatar answered Nov 04 '22 06:11

Azadeh Khojandi


In package manager console Visual Studio 2013

PM> Install-Package Newtonsoft.Json

Then restart Visual Studio.

like image 3
Michael Avatar answered Nov 04 '22 07:11

Michael