36

I want to list down all the nuget packages along with its dependencies recursively. Project is in VS2017 and .NET Core.

I tried with Get-Package -ProjectName "Your.Project.Name" it displays all the nuget packages in project. I want all the dependencies also printed.

Pavan
  • 1,023
  • 2
  • 12
  • 25
  • 2
    Hi Pavan, please check this doc: https://github.com/NuGet/Home/wiki/dotnet-list-package, wen can use the option: --include-transitive to displays the transitive packages in the result, but the list package command will work only with the dotnet command line with package reference projects. Support for nuget.exe and package config projects will come in later versions. For the nuget.exe, we still cannot use it to list the nuget package and its dependencies. Now we can only use the Get-Package to list all installed nuget package not includes the dependencies, sorry for this inconvenience. – Sara Liu - MSFT Mar 27 '19 at 04:26

1 Answers1

49

You can use the dotnet cli: dotnet list package --include-transitive. The dotnet-outdated global tool probably has similar functionality.

zivkan
  • 12,793
  • 2
  • 34
  • 51
  • 6
    This is great, but displays packages as one of two categories: explicit or transitive. I want a tool that shows the directed graph/tree of transitive dependencies. – Tim Sparkles Sep 22 '21 at 00:42
  • 7
    You'll need to parse the project's `project.assets.json` file and create the graph yourself. I'm not aware of any tool that does it for you. If you create such a tool and publish it as a dotnet tool, you'll be a world leader! :) – zivkan Sep 22 '21 at 14:11
  • 1
    @zivkan thank you for pointing out `project.assets.json` - even though it's (usually) a long text file and not very user friendly, in the few cases where I needed to figure out a dependency problem, just finding text in it using Notepad++ answers the question. – Mr. TA May 03 '22 at 03:00
  • Is there a UI way of seeing the packages or searching for the packages ? – Deepak paramesh Jun 13 '23 at 12:20