Somehow during the upgrade to VS2012 and .NET 4.5, I've managed to get NuGet confused. There are packages that appear in the package manager (and the packages folder) that I cannot delete (I believe they are legacy ASP.NET NuGet packages that have been replaced with new package names with the new version. They each have only a Manage button -- but no uninstall button. And when you look to see where they are used, you can see that they are referenced by none of the solution's projects? They are NOT displaying an Uninstall?
11 Answers
I've found a workaround for this.
- Enable package restore and automatic checking (Options / Package Manager / General)
- Delete entire contents of the packages folder (to Recycle Bin if you're nervous!)
- Manage Nuget Packages For Solution
- Click the restore button.
NuGet will restore only the packages used in your solution. You end up with a nice, streamlined set of packages.

- 16,456
- 10
- 53
- 70
-
1Won't this _not_ remove the package from `packages.config` and _not_ remove the references from the project? – CodeCaster Jan 07 '14 at 10:59
-
1@CodeCaster hard to parse your double negative. Nothing will be removed from config and references. The idea here is to remove the NuGet packages that are no longer referenced – James L Jan 07 '14 at 14:23
-
1Excellent answer! If you are using TFS you should delete all content inside of ./packages in source countrol explorer first so that other clients like build machines will remove redundant items too. – Alexander Schmidt Feb 04 '14 at 10:30
-
5@sprinter252, if you're using package restore, you're not supposed to check the packages into source control in the first place. That's one of the main benefits of using package restore. As part of converting to package restore, an 'ignore' rule should be placed on the packages folder. – Carl Bussema May 13 '14 at 15:23
-
@CarlBussema You're right. Since the new NuGet-version this isn't so important because Nuget won't add any binaries into the subfolders. So you're only getting the folder structure. My comment was related to the default behavior of TFS (packages-folder included). On TFS Anywhere ignores are ignored often ;-). Important for mixed projects with Xamarin. – Alexander Schmidt May 14 '14 at 08:41
-
@JamesL You can right-click the project's `References` folder in Solution Explorer and click `Remove Unused References`. – ProfK Feb 04 '17 at 05:00
-
I had over a 1gig of packages in .nuget! The library of congress would have taken less space! – ATL_DEV Jan 25 '18 at 21:47
-
I had to edit packages.config but as this file was under source control when I fired up the project on a different computer the dam thing would appear again. So had to edit packages.config and remove it from source control – Moon Waxing Apr 22 '18 at 01:33
You can use Package Manager Console with command: Uninstall-Package PackageId
to remove it, or just delete package folder from 'packages' folder under solution folder.
More information about Package Manager Console you can find here: http://docs.nuget.org/docs/reference/package-manager-console-powershell-reference

- 7,697
- 3
- 37
- 22
-
9Thanks Pavel. I had a feeling you could just delete the folders. It's a little disconcerting because I have to manually ensure that none of the packages are referenced (they don't appear to be). I'm still kind of curious to know why the package manager doesn't show an Uninstall (or remove) button. – Howard Pinsley Aug 19 '12 at 21:33
-
3Package manager on solution level displays all packages references to projects from solution and additional all packages which placed in packages folder, but don't referenced. For this packages no uninstall ability in UI. I'm agree that it's result of incorrect behavior, but in this case you should check it manually. And delete package or reinstall this when you will be sure need you it or not. – Pavel Bakshy Aug 19 '12 at 22:03
-
1By just removing the folder and going back to NuGet and see the package, it somehow still displays as installed with the green tick beside it, better to do the proper uninstallation using the console. – k80sg Jan 22 '13 at 12:51
-
-
This only applies of the package is actually installed. I am experiencing all the same symptoms except that the package is not in either the packages.config or the packages directory. – Uatec Sep 03 '13 at 14:09
-
1@ysrb, its a powershell command which goes verb-noun such as get-user or remove-item, your example is noun-verb – Nick Young Mar 07 '16 at 21:21
-
1@ysrb As Nick Young says, and besides, it would be a horrendous compliment to `Install-Package`. – ProfK Feb 04 '17 at 04:58
First open the Package Manager Console. Then select your project from the dropdown list. And run the following commands for uninstalling nuget packages.
Get-Package
for getting all the package you have installed.
and then
Uninstall-Package PagedList.Mvc
--- to uninstall a package named PagedList.MVC
Message
PM> Uninstall-Package PagedList.Mvc
Successfully removed 'PagedList.Mvc 4.5.0.0' from MCEMRBPP.PIR.

- 13,970
- 24
- 112
- 161

- 5,087
- 46
- 35
-
This answer worked perfectly for me. My situation was that the package only showed up under the Updates tab of the dialog... and when I hit Update *no* projects had the package installed -- so there was no way to update it or remove it. – azarc3 Jun 24 '15 at 14:10
If you want to delete/uninstall Nuget package which is applied to multiple projects in your solutions then go to:
Tools-> Nuget Package Manager -> Manage Nuget Packages for Solution
In the left column where is 'Installed packages' select 'All', so you'll see a list of installed packages and Manage button across them.
Select Manage button and you'll get a pop out, deselect the checkbox across project name and Ok it
The rest of the work Package Manager will do it for you.
VS2019 > Tools > Options > Nuget Package Manager > General > Click on "Clear All Nuger Cache(s)"

- 656
- 2
- 8
- 19
-
Thank you. This resolved my issue. The references were gone. But they still showed in the Solution Explore. – Strider489 Aug 30 '21 at 19:04
If you have removed package using Uninstall-Package utility and deleted the desired package from package directory under solution (and you are still getting error), just open up the *.csproj file in code editor and remove the tag manually. Like for instance, I wanted to get rid of Nuget package Xamarin.Forms.Alias and I removed these lines from *.csproj file.
And finally, don't forget to reload your project once prompted in Visual Studio (after changing project file). I tried it on Visual Studio 2015, but it should work on Visual Studio 2010 and onward too.
Hope this helps.
Solution 1
Use the powershell pipeline to get packages and remove in single statement like this
Get-Package | Uninstall-Package
Solution 2
if you want to uninstall selected packages follow these steps
- Use
GetPackages
to get the list of packages - Download Nimble text software
- Copy the output of
GetPackages
in NimbleText(For each row in the list window) - Set Column Seperator to
(
if required - Type
Uninstall-Package $0
(Substitute using pattern window) - Copy the results and paste them in Package Manage Console
That be all folks.

- 1,690
- 1
- 23
- 24
An alternative, is install the unused package you want to delete in any project of your solution, after that, uninstall it and Nuget will remove it too.
A proper uninstaller is needed here.

- 1,958
- 5
- 34
- 46

- 5,634
- 3
- 36
- 56
One NuGet package can reference another NuGet package. So, please be very careful about inter-package dependencies. I just uninstalled a Google map package and it subsequently uninstalled underlying packages like Newtonsoft, Entity Framework, etc.
So, manually deleting particular package from packages folder would be safer.
From the Package Manager console window, often whatever command you used to install a package can be used to uninstall that package. Simply replace the INSTALL command with UNINSTALL.
For example, to install PowerTCPTelnet, the command is:
Install-Package PowerTCPTelnet -Version 4.4.9
To uninstall same, the command is:
Uninstall-Package PowerTCPTelnet -Version 4.4.9

- 12,626
- 9
- 52
- 59
If you want to use Visual Studio option, please see How to remove Nuget Packages from Existing Visual Studio solution:
Step 1:
In Visual Studio, Go to Tools/NuGet Package Manager/Manage NuGet Packages for Solution…
Step 2:
UnCheck your project(s) from Current solution
Step 3:
Unselect project(s) and press OK

- 15,725
- 6
- 48
- 68

- 17
- 2
-
2It is preferable to write out the answer in StackOverflow rather than just posting a link to it because links can expire in the future. – Amadeus Sanchez Mar 10 '16 at 18:32