Skip to content

Instantly share code, notes, and snippets.

@brlinton
Forked from haacked/download-nuget-licenses.ps1
Last active September 17, 2015 02:50
Show Gist options
  • Save brlinton/036007293f0adc403cb3 to your computer and use it in GitHub Desktop.
Save brlinton/036007293f0adc403cb3 to your computer and use it in GitHub Desktop.
A PowerShell script to download your NuGet package licenses as first seen in http://haacked.com/archive/2015/03/28/download-nuget-package-licenses/
@( Get-Project -All |
? { $_.ProjectName } |
% { Get-Package -ProjectName $_.ProjectName } ) |
Sort -Unique |
% { $pkg = $_ ; Try { (New-Object System.Net.WebClient).DownloadFile($pkg.LicenseUrl, 'c:\dev\licenses\' + $pkg.Id + ".txt") } Catch [system.exception] { Write-Host "Could not download license for $pkg" } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment