How do I list all installed NuGet packages?

前端 未结 9 1847
旧时难觅i
旧时难觅i 2020-12-23 15:58

How does one list all locally installed NuGet packages?

Is there a NuGet equivalent of RPM -qa? Within Chocolatey there is the chocolatey list -loc

相关标签:
9条回答
  • 2020-12-23 16:30

    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
    
    0 讨论(0)
  • 2020-12-23 16:33

    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.

    0 讨论(0)
  • 2020-12-23 16:34

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

    Get-Package
    

    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.

    0 讨论(0)
提交回复
热议问题