Created
October 5, 2012 16:21
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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