Why can't I add the newtonsoft.Json.dll ref to my project?
Its probably something in your build system: the dll is likely getting cleaned (as in deleted by a rebuild), or is in a directory that isn't under your solution, or simply isn't getting copied to the output directory.
I'm sorry I don't have a more specific piece of advice. What I'm going to do though is suggest you use a shot-gun to kill a mosquito: use NuGet. In C# with Visual Studio (or any other .net IDE), you really want to use the nuget package manager, since it works so well.
- Install the visual studio extension,
- right click on your solution (dont do the project, do the solution)
- select 'Manage Nuget Packages for Solution'
- click 'online', in the search box type 'newtonsoft'
- click 'Install' on 'Json.NET' (probably, what your looking for might be in another package, I'll ask you to track it down).
This will put it in a library directory, include it in the build path, and allow you to use the Intelli sense to auto-add the appropriate reference from your project.
Make sure that the your project target framework is set to the correct version. It might be that your target .NET framework for the project is lower than what the Newtonsoft dll was built under. Right click on your project and see what it's set at. You'll need to go view the properties.
I had the same problem.
Nuget works, but for older Visual Studios, such as 2005/2008, it can be tricky (And that, unfortunately, was my case).
I downloaded Json.NET here. Inside binaries, choose the one that matches your .Net Framework version, add the dll inside a folder of your project (e.g. lib), and include it as a reference. Then, have fun!