2

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?

nhenrique
  • 874
  • 1
  • 16
  • 35
  • Is the `CopyLocal` setting, set to true? – Arran Sep 02 '13 at 11:06
  • 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 Sep 02 '13 at 11:06
  • 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 Sep 02 '13 at 11:08
  • Check out the answers to this similar question: http://stackoverflow.com/questions/17776090/newtonsoft-json-assembly-conflict/21639708#21639708 – zbarrier Feb 07 '14 at 23:43

2 Answers2

2

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.

dcastro
  • 66,540
  • 21
  • 145
  • 155
1

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.
Mikaël Mayer
  • 10,425
  • 6
  • 64
  • 101