After running a clean solution and rebuild, my MVC 4 Web API project stops working. It\'s can\'t find Newtonsoft.Json.
I know that MS is using this as the default JS
I tested everything that was said here and nothing worked. In my case I had a path folder like this.
The # the cause of my problem. I removed the # and worked fine.
For me the only thing that fixed this error was to add the missing section to my web.config file, which I got from this answer here: https://stackoverflow.com/a/20414714/940783
Here is what I needed to add:
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
Ok - found a work around myself, posting in case someone else gets caned by this MS bug. The problem is that you can't add a NuGet reference as it's already included in the packages by default. So...
I combined a couple of the options the other SO contributors stated, plus a new one.
First, It turns out that Nuget 2.1 had some issues, and this issue was logged in a bug, and was fixed in 2.2.2. See here: https://nuget.codeplex.com/workitem/3050
So, I did the following steps:
For any package already installed by NuGet that you want to re-install just type the following command in Package Manager Console:
Update in any project:
Update-Package Newtonsoft.Json -Reinstall
Update in a specific project
Update-Package Newtonsoft.Json -Reinstall -Project My.App
I had the same problem (in VS2012). No answer helped me. Finally I solved it by this:
1) Go to TOOLS -> EXTENSIONS AND UPDATES here update (or install) "NuGet Package Manager" next go to "Online" and install "Quick add NuGet" and "NuGet References"
2) after insttal all in 1) in your project right click to "References" and choose "Manage Nuget Packages" in "Installed packages" find Json.NET. Click Uninstall - you cannot do this now, but it show you what you must uninstall first (some ASP Web Api client). So uninstall all of these and try uninstall "Json.NET" again. Now go to "Online" and install "Json.NET", "ASP.NET WEB API Client Libraries" and "ASP.NET WEB API Client OData".
3) in Global.asax delete row "WebApiConfig.Register(GlobalConfiguration.Configuration);"
build solution and all shoud be ok.. I hope this can help someone :) gl