Can't uninstall/reinstall NuGet package

In your Solution or Project you will find a file called packages.config. Open this file and you will see all the packages that NuGet has installed.

The file will look something like this:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Json" version="2.0.3" targetFramework="net45" />
</packages>

Simply delete the line of your package and save the file.

<?xml version="1.0" encoding="utf-8"?>
<packages>
</packages>

Then run NuGet again and it should install.

The JSON.NET NuGet package should just work with a Windows Phone 8.0 project. Adding it in VS2012 NuGet manager pulls in the WP7 version of JSON.NET. (packages\Newtonsoft.Json.4.5.10\lib\sl3-wp\Newtonsoft.Json.dll)

JSON.NET is now also available as a Portable Class Library which you can consume from WP8 (available in NuGet or in source form).

UPDATE:

The latest version of NuGet has an uninstall.

VS 2013:

In the solution, right click on References and Manage NuGet packages, you will find "Installed Packages" in the upper left hand corner. Select the package and an uninstall option will be available.

VS 2015:

In the solution, right click on References and Manage NuGet packages, find the "Installed" tab in the upper right. Hover over the package and the "X" will appear to uninstall.

VS 2017:

On the solution, right click and "Manage NuGet packages for solution", find the "Installed" tab in the upper left. Click on the package and in the right hand panel will be an "Uninstall" button.

VS 2019:

(Identical to 2017) On the solution, right click and "Manage NuGet packages for solution", find the "Installed" tab in the upper left. Click on the package and in the right hand panel will be an "Uninstall" button.


I had the same problem. I wasn't able to re-install my package even after all the package.config modifications. Here what work for me.

In your solution folder there should be a "packages" directory. Open this directory and delete the directory associated with your package.

Done.


Just sat four hours on my new Windows 10 machine and couldn't figure out why no references worked in Visual Studio 2015 and why I could not restore NuGet packages. For some reason TFS added two packages folders:

Locations:

C:\Users\YourUser\Documents\Visual Studio 2015\Projects\YourProject\packages

C:\Users\YourUser\.nuget\packages

When both of the package folders were removed I could restore NuGet packages and everything worked again.