Skip to content

Instantly share code, notes, and snippets.

@tjrobinson
Forked from haacked/download-nuget-licenses.ps1
Last active December 28, 2017 23:45
Show Gist options
  • Save tjrobinson/aaf540f04946a74dceed to your computer and use it in GitHub Desktop.
Save tjrobinson/aaf540f04946a74dceed to your computer and use it in GitHub Desktop.
Split-Path -parent $dte.Solution.FileName | cd
New-Item -ItemType Directory -Force -Path ".\licenses"
@( Get-Project -All |
? { $_.ProjectName } |
% { Get-Package -ProjectName $_.ProjectName } ) |
Sort -Unique |
% { $pkg = $_ ; Try { (New-Object System.Net.WebClient).DownloadFile($pkg.LicenseUrl, (Join-Path (pwd) 'licenses\') + $pkg.Id + ".html") } 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