2
votes

I am developing a Ribbon control and I want to use JSON.NET. I'm having this error :

Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.

I've tried a couple of things, that I found here in stackoverflow such as:

  • reinstall JSON.NET, with nuget console;
  • Open up packages.config
  • Delete the Newtonsoft.Json entry.
  • Save and Build Re-add Newtonsoft.Json from NuGet.
  • Build and run
  • checked files on bin folder

nothing seems to work, any ideias?

2
Is the CopyLocal setting, set to true? - Arran
Are you 100% sure you have 4.5.0.0 version of JSON.NET? Then try changing x86 to any CPU in build config of your solution - Kamil Budziewski
actually on web.config file I have the version 5.0.6, why does the error says 4.5.0.0? And yes CopyLocal is set to true - nhenrique
Check out the answers to this similar question: stackoverflow.com/questions/17776090/… - zbarrier

2 Answers

1
votes

Finally I found my solution:

  • Right-click on the "references" of your project.
  • Add a referencec
  • In the framework tab, type "json.net". I had two versions: 4.5 and 6.0. I only checked 4.5 and left the 6.0 unchecked.
  • Rebuild and relaunch the project, and this error disappeared for me.
2
votes

Do any of the other projects in the same solution also reference Json.Net? It may be that different projects in the same solution refer to different version of Json.Net.