Could not load file or assembly 'Newtonsoft.Json

Getting this error, editor works but cant build.

FileNotFoundException: Could not load file or assembly ‘Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed’ or one of its dependencies.
System.Reflection.MonoMethodInfo.GetMethodInfo (System.IntPtr handle) (at :0)

I have in my app.config:



And in my Packages.config:

Unity 2017.4.6f1 .NET 4.6

bump please

I was using the JSON .NET package from the Asset Store and suddenly started having the same issue. I removed that package and just imported the Newtonsoft.Json.dll into the Plugins directory and that resolved the issue for me.

I’m not sure why the asset package started failing but, since the Unity editor now supports .NET 4.x, we can just import the dll as a New Asset.

I have Edit->Project Settings->Player->Other Settings->Api Compatibility Level set to .NET 4.x.

This problem was caused by Microsoft Rest dll I had imported for no good reason. I’m not sure why, but after trying to get rid of a lot of stuff, that finally did the trick.