Unlist.ps1
· 558 B · PowerShell
Raw
function Remove-AllNuGetPackageVersions($PackageId, $ApiKey)
{
$lower = $PackageId.ToLowerInvariant();
$json = Invoke-WebRequest -Uri "https://api.nuget.org/v3-flatcontainer/$lower/index.json" | ConvertFrom-Json
foreach($version in $json.versions)
{
Write-Host "Unlisting $PackageId, Ver $version"
Invoke-Expression "dotnet nuget delete $PackageId $version --non-interactive --api-key $ApiKey --source https://api.nuget.org/v3/index.json"
}
}
Remove-AllNuGetPackageVersions -PackageId "MoongladePure.Web" -ApiKey "YOUR_KEY"
| 1 | function Remove-AllNuGetPackageVersions($PackageId, $ApiKey) |
| 2 | { |
| 3 | $lower = $PackageId.ToLowerInvariant(); |
| 4 | |
| 5 | $json = Invoke-WebRequest -Uri "https://api.nuget.org/v3-flatcontainer/$lower/index.json" | ConvertFrom-Json |
| 6 | |
| 7 | foreach($version in $json.versions) |
| 8 | { |
| 9 | Write-Host "Unlisting $PackageId, Ver $version" |
| 10 | Invoke-Expression "dotnet nuget delete $PackageId $version --non-interactive --api-key $ApiKey --source https://api.nuget.org/v3/index.json" |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | Remove-AllNuGetPackageVersions -PackageId "MoongladePure.Web" -ApiKey "YOUR_KEY" |