I have a package in a private package feed of my Visual Studio Team Services (VSTS) account and want to unlist all versions of my package since it's deprecated and has been superseded by a different package.Thus I want to mark the old package as deprected by unlisting it (not deleting it, if possible)
Unfortunately all I can find is a button that unlists one specific version of the package, like described here. Removing my legacy package that way takes ages since I have to unlist easily 30 versions before the package is removed from my feed.
I know that nuget.org has the functionality to unlist all versions of a package with just one click and I'd consider it to be a basic function. Does anyone know whether there's a trick or hidden button that allows me to unlist packages more easily in VSTS? Or is there maybe a nuget cli command for that?
No matter by VSTS web UI or nuget cli, the packages can only be unlisted one by one.
The format for unlist a package as:
nuget delete <packageID> <packageVersion> [options]
But you can write your own script to unlist packages in your VSTS feed in loop. Detail steps as:
1. Add the VSTS feed as source with credential
nuget sources add -Name "feedname" -Source "https://account.pkgs.visualstudio.com/_packaging/feedname/nuget/v3/index.json" -Username <Alternate username/email> -password <Alternate password/PAT>
2. List all the packages in the VSTS feed
nuget list -source feedname -AllVersions
3. Loop the packages you get in step2, and unlist them in the loop
nuget delete packagename packageversion -source feedname -ApiKey key