Zuletzt aktiv 1735985299

Unlist.ps1 Orginalformat
1# 示例:对多个包执行Unlist操作
2$packages = @(
3 "Aiursoft.Archon.SDK",
4 "Aiursoft.Developer.SDK",
5 "Aiursoft.Directory.SDK",
6 "Aiursoft.DocGenerator.Abstract",
7 "Aiursoft.DotDownload.Core",
8 "Aiursoft.Dotlang.Core",
9 "Aiursoft.Gateway.SDK",
10 "Aiursoft.Handler",
11 "Aiursoft.Handler.Abstract",
12 "Aiursoft.Pylon",
13 "Aiursoft.SDK",
14 "Aiursoft.SDK.Tests",
15 "Aiursoft.SDKTools",
16 "Aiursoft.SnakeGame",
17 "Aiursoft.Stargate.SDK",
18 "Aiursoft.Status.SDK",
19 "Aiursoft.UiStack",
20 "Aiursoft.Wrapgate.SDK",
21 "Aiursoft.XelNaga",
22 "AiurVersionControl",
23 "AiurVersionControl.CRUD",
24 "Anduin.HappyRecorder.Calendar",
25 "Anduin.HappyRecorder.PluginFramework",
26 "Anduin.QRCoder",
27 "Anduin.QRCoder.NET",
28 "Crawler.CLTeans",
29 "Crawler.FantasticBodies",
30 "Crawler.FlexyTeens",
31 "Crawler.Shared",
32 "DemoApiApp.Sdk",
33 "Diff4Net.Core",
34 "Kahla.SDK",
35 "MoongladePure.Comments",
36 "MoongladePure.Configuration",
37 "MoongladePure.Core",
38 "MoongladePure.Data",
39 "MoongladePure.Data.MySql",
40 "MoongladePure.FriendLink",
41 "MoongladePure.ImageStorage",
42 "MoongladePure.Syndication",
43 "MoongladePure.Theme",
44 "MoongladePure.Utils",
45 "MoongladePure.Web",
46 "NiBot"
47)
48
49
50$apiKey = "aaaaaaaaaaaaaaaaaaaaaaaaa"
51
52function Remove-AllNuGetPackageVersions($PackageIds, $ApiKey)
53{
54 foreach ($PackageId in $PackageIds) {
55 $lower = $PackageId.ToLowerInvariant()
56
57 try {
58 $json = Invoke-WebRequest -Uri "https://api.nuget.org/v3-flatcontainer/$lower/index.json" -ErrorAction Stop | ConvertFrom-Json
59
60 foreach ($version in $json.versions) {
61 Write-Host "Unlisting $PackageId, Version $version"
62 Invoke-Expression "dotnet nuget delete $PackageId $version --non-interactive --api-key $ApiKey --source https://api.nuget.org/v3/index.json"
63 Start-Sleep -Seconds 10
64 }
65 }
66 catch {
67 Write-Host "Error unlisting $PackageId $_" -ForegroundColor Red
68 }
69 }
70}
71
72Remove-AllNuGetPackageVersions -PackageIds $packages -ApiKey $apiKey
73
74