Skip to content

Instantly share code, notes, and snippets.

@knunery
Created October 5, 2012 16:21
Show Gist options
  • Save knunery/3840798 to your computer and use it in GitHub Desktop.
Save knunery/3840798 to your computer and use it in GitHub Desktop.
PowerShell script to find all of the Nuget packages being used in the source code
# PowerShell script to find all of the Nuget packages being used in the source code
# get all packages.config files
$files = ls -Filter packages.config -Recurse
# create an empty array in powershell
$packages = @()
# get the name of the packages in each file
foreach($file in $files)
{
$xml = [xml]"<root></root>"
$xml.Load($file.FullName)
foreach($package in $xml.packages.package)
{
$packages = $packages + $package.id
}
}
$knownpackages = ("Backbone", "Foundation","Quartz.NET","RavenDB","Mongo")
$packages = $packages + $knownpackages
# get unique package names
$packages = $packages | select -uniq | sort
$packages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment