List Choco package dependencies

In PowerShell, list the dependencies of all installed Chocolatey packages with the following:

$dependency_table = @{}
ls C:\ProgramData\chocolatey\lib -Recurse "*.nuspec" | % {
  $dependencies = ([xml](cat $_.FullName)).package.metadata.dependencies.dependency | % {
    $_.id
  }
  if ($dependencies) {
    $dependency_table.Add($_.BaseName, $dependencies)
  }
}
[PSCustomObject]$dependency_table | Format-List

Minified:

$t = @{}; ls C:\ProgramData\chocolatey\lib -r "*.nuspec" | % {if ($d = (([xml](cat $_.fullname)).package.metadata.dependencies.dependency | % {$_.id})) {$t.add($_.basename, $d)}}; [PSCustomObject]$t | fl

Format-List, or fl, is optional and purely cosmetic. If there are enough properties, or in this case packages with dependencies, then PowerShell will automatically format the output as a list as opposed to a table.

Note that, should X depend on Y and Y depend on Z, this does not directly show that X depends on Z.

Side note: choco uninstall pkgname -x force uninstalls a package’s dependencies (in addition to the package itself), should no other installed packages be dependent on them.

reference on Format-List