See the question and my original answer on StackOverflow

There are many ways to fix this (mess). Here is one

enter image description here

  • delete the legacy packages.config file.
  • remove all existing references (see the picture below)
  • edit the .csproj manually and remove all lines that contain "..packages..." stuff, including all lines that check for some nuget presences, and also the associated imports and tasks.
  • add Microsoft.VisualStudio.Shell.15.0 and Newtonsoft.Json as a nuget packages. You should now see something like this (note the new nuget references with the blue icon):

enter image description here

  • you should be able to compile and run successfully

For a few months now, everytime I face impossible nuget issues, that's what I do. I copy the old packages.config somewhere, delete it from the project, remember the "root" packages, remove every reference, check the csproj, and add the new references from nuget (trying to add the fewest possible so the child references are ok). Nuget is the future for all references now (we'll have to bite the bullet whether we like it or not), even for Visual Studio ones.