How do I delete NuGet packages that are not referenced by any project in my solution?

前端 未结 11 1092
攒了一身酷
攒了一身酷 2021-01-30 01:53

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 c

相关标签:
11条回答
  • 2021-01-30 02:21

    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.

    0 讨论(0)
  • 2021-01-30 02:24

    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

    0 讨论(0)
  • 2021-01-30 02:29

    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.

    0 讨论(0)
  • 2021-01-30 02:36

    If you want to delete/uninstall Nuget package which is applied to multiple projects in your solutions then go to:

    1. Tools-> Nuget Package Manager -> Manage Nuget Packages for Solution

    2. In the left column where is 'Installed packages' select 'All', so you'll see a list of installed packages and Manage button across them.

    3. 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.

    0 讨论(0)
  • 2021-01-30 02:38

    VS2019 > Tools > Options > Nuget Package Manager > General > Click on "Clear All Nuger Cache(s)"

    0 讨论(0)
  • 2021-01-30 02:40

    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.
    
    0 讨论(0)
提交回复
热议问题