Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0' - However binary exists in bin folder

I am trying to do something pretty simple here, and I've been stuck on it for several hours. I feel like I've exhausted almost every option.

All I am trying to do is: JsonConvert.SerializeObject(model)

However, the resulting error is:

Exception thrown: 'System.IO.FileLoadException' in mscorlib.dll

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

However, in my project, I am referencing version 10.0.0.0. More Specifically, 10.0.2.0. When I checked my bin folder for the project, I can verify that the 10.0.2.0 dll is there. In packages.config, I have <package id="Newtonsoft.Json" version="10.0.2" targetFramework="net452" />

Things I have tried:

  1. Manually deleteing the bin/obj folders from the project and rebuilding
  2. Manually Modifying the Web.Config file to ensure the right version in the binding redirect.
  3. Updating the Reference Property 'Specific Version' to False
  4. Manually delete all of the files in C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root

I am really stuck here, and I can see this is a common problem as I found a lot of different approaches to fix it, however none have worked so far.

Any ideas?

like image 233
Tabrock Avatar asked May 09 '17 16:05

Tabrock


1 Answers

In package manager console execute: Update-Package –reinstall Newtonsoft.Json.

source

like image 103
MorenajeRD Avatar answered Sep 29 '22 10:09

MorenajeRD