121

How does one list all locally installed NuGet packages?

Is there a NuGet equivalent of RPM -qa? Within Chocolatey there is the chocolatey list -localonly, but for the life of me I cannot find the NuGet equivalent of that command.

9 Answers 9

134

In the NuGet Package Manager Console, enter the following command:

Get-Package | Format-Table -AutoSize

This will either print out a list of installed packages, or if none are present write the following line to the console:

PM> Get-Package
No packages installed.

For more details, have a look at the NuGet PowerShell Reference.

3
  • 14
    Is there a way to do this using nuget.exe?
    – bitbonk
    Dec 21, 2016 at 8:25
  • 3
    After running the command Get-Package, packages' names are trimmed when they have more than 32 characteres. Is it possible to increase the package name column so that the output show the full names without trimming them? Mar 16, 2017 at 12:44
  • 17
    Get-Package | Format-Table -AutoSize will do it
    – Mant101
    May 12, 2017 at 15:05
71

If you just do

Get-Package

it will list the packages and where they are referenced. It will list the same packages over and over again if you have them referenced many times. If you want to get a clean list of all packages installed in the solution you can do

Get-Package | select -Unique Id, Versions
1
  • 5
    To sort: `Get-Package | select -Unique Id, Versions | sort Id
    – John H
    May 5, 2021 at 17:09
18

If you have the .NET Core runtime installed, you can use the dotnet list package command in the .NET Core CLI tools to fetch installed packages for a given solution or project. Use it like so from the Windows command line:

dotnet list "C:\Source\MySolution\MySolution.sln" package

It works on both .NET Framework and .NET Core projects.

Note: For this command to work, the solution must use the new NuGet PackageReference format for referencing NuGet packages. Migration is as easy as right-clicking packages.config, and clicking "Migrate packages.config to PackageReference...", then restoring packages by building the solution.

4
  • Does work for .NET Core but not for .NET 4.5 Solution: At least this is the case on my computer. May 30, 2020 at 6:22
  • 1
    @ChristianCasutt I just tested it and it works just fine on .NET Framework 4.5, the only thing I had to do was migrate from packages.config to PackageReference, and then restore nuget packages by building the solution. Jun 1, 2020 at 9:50
  • Isn't there a difference between referencing/use and installed? Aren't NuGet packages installed globally, independent of solutions/projects? Jun 25, 2020 at 9:44
  • @PeterMortensen I'm assuming here that the OP meant installed for a project/solution. Globally the downloaded packages are cached, and I don't think the term "installed" would make sense in that context. Jun 25, 2020 at 9:56
17
Get-Package -ProjectName "Your.Project.Name"

Will show the packages for the specified project.

See also: Package Manager Console PowerShell Reference

Note that each project will have a packages.config file which is used to track installed packages. If this is altered (specifically if you alter it backwards), the projects may not automatically download the correct package version. In that case, make a note of the packages required and do a uninstall-package, followed by a install-package for each.

Also, backups are your friend! ;)

13

In Visual Studio,

  • go to the Project or Solution in question
  • right click, Manage NuGet Packages...
  • on the left, you will see 'Installed Packages'
  • click on this and you will see the list
0
12

In addition to all of the given answers, there is also a clean listing in XML format of all installed packages in your Visual Studio project root folder: packages.config:

Enter image description here

4
  • In my opinion, the best response. Aug 16, 2018 at 19:07
  • 3
    With the new project file structure introduced in Visual Studio 2017 version 15.7 NuGet packages can (or will for new projects) be moved to the project file, and you won't find a packages.config file. See Microsoft documentation. Apr 14, 2020 at 14:29
  • This only gives you one project at a time though. I have about 250 projects in my solution so other answers are better if you don't want to go through the solutions one at a time.
    – RosieC
    Oct 9, 2020 at 12:19
  • For newer solutions, changes are high that you do not have a packages.config file, but instead PackageReference inside project file or even in lock files. There are now several ways to list up nuget packages ! Nov 24, 2021 at 9:09
9

Answer to "Is there a way to do this using nuget.exe? – bitbonk":

nuget list -Source C:/packages

Where C:/packages is a path to your local repository.

1
  • 1
    Note that I had to use an absolute path for this to work.
    – Chris Long
    Dec 14, 2020 at 23:25
7

How do I list all installed NuGet Packages?

Assuming that NuGet is properly installed

Right click Project node and click Manage NuGet Packages

Right click Project node

See installed packages list

See installed packages

2

Answer to "Is there a way to do this using nuget.exe?" – bitbonk

Based on the answer from jstar above. I used \ instead of / which fits more to the Windows environment where nuget is at home. My edit of the answer was rejected so I post my own.

nuget list -Source c:\code\packages

Where c:\code is a path to your local code-repository. The packages folder is on the same level like your solution-file (*.sln).

1
  • But this lists the sources (where the packages come from), not the installed packages (?). Jun 25, 2020 at 9:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.