Last active
October 26, 2024 20:35
-
-
Save dstockhammer/059d5ef6b9b6b3870e40e75a62a25a4d to your computer and use it in GitHub Desktop.
Unlist all versions of a NuGet package
This file contains 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
$PackageId = "xxx" | |
$ApiKey = "yyy" | |
$json = Invoke-WebRequest -Uri "https://api.nuget.org/v3-flatcontainer/$PackageId/index.json" | ConvertFrom-Json | |
foreach($version in $json.versions) | |
{ | |
Write-Host "Unlisting $PackageId, Ver $version" | |
Invoke-Expression ".\nuget.exe delete $PackageId $version $ApiKey -source https://api.nuget.org/v3/index.json -NonInteractive" | |
} |
The value for PackageId
must be entered in lower case.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for your GIST - it helped me too!