Newtonsoft.Json version 8.0.2 Could not load file or assembly Error
I was fixing some old code in one of my Windows Phone 8 solutions and thought of updating the NuGet packages and was greeted with the same issue.
A comment from StivOstenberg here helped me solve this.
This is what I did:
- Removed the NuGet package. Just clicked 'Uninstall' from NuGet manager. Make sure to remove it from every project in the solution separately.
- Clean Solution. Rebuild Solution.
- Now, remove the using statement from your entire solution! Can be done with a quick find and replace for using Newtonsoft.Json on 'Entire Solution'.
- Repeat step 2. (Ignore the errors)
- Add package again from NuGet manager & build (Ctrl+Shift+B).
- Finally (almost), for every error shown, go to the particular page and add reference again.
- Repeat step 2 and Run.
There might be some redundant steps, but this is exactly what I did, and it worked. Hope it helps you too.
Make sure there are no conflicting versions of Newtonsoft in a parent assembly!
In a child-assembly I wanted to use Newtonsoft.Json.8.0.3.
Well the StartUp project is an MVC5 web app. There I use the BundleTransformer.Less.X.X.X which had a dependency to Newtonsoft.Json.8.0.2. Upgrading NewtonSoft.Json to 8.0.3 (all the same version now) resolved it for me.