Unlist, delete, or recover a NuGet package

VSTS | TFS 2018 | TFS 2017

There are two options available to remove a version of a NuGet package from a feed.

  1. Unlist: Unlisting a version of a package modifies how the package appears in NuGet clients (see the NuGet docs for a full description of how unlist works). Unlisting a version can help you prevent new usage of it without breaking dependent projects and builds.
  2. Delete: Deleting a version of a package makes it unavailable for install. After deleting, a package can be restored from the Recycle Bin within 30 days of deletion. After 30 days, it is permanently unavailable to restore. Deleting a package will cause others that depend on it to break.

Unlist and delete both respect feed immutability. Once you publish a particular version of a package to a feed, that version number is permanently reserved. You cannot upload a newer revision package with that same version number, or delete it and upload a new package at the same version.

Unlisting or deleting a NuGet package in VSTS

You must be a contributor to unlist and an owner to delete.

Choose the package from the Packages hub in the Build and Release hub group and select the appropriate option from the menu:

Unlist or delete npm package Visual Studio Team Services

Unlisting a NuGet package using NuGet.exe

First, get the tools (make sure you're using NuGet 3.5 or later) and your feed URL:

  1. Navigate to your feed (or create a feed if you haven't).

  2. Select Connect to feed:

    Connect to feed button in the upper-right of the page

  3. Follow steps 1, 2, and 3 to get the tools, add the feed to your local NuGet configuration, and push the package.

    NuGet publish instructions in the Connect to feed dialog

Then, run

nuget.exe delete {your_package_id} {version} -Source {feed URL} -ApiKey key

Currently, NuGet.exe can only unlist packages; VSTS and TFS interpret nuget.exe delete as an unlist operation to be consistent with NuGet.org. To delete a package, you must use either the REST APIs or the web interface.

Recover a deleted NuGet package

If you've deleted/unpublished an npm package, NuGet package, or Maven artifact from Visual Studio Team Services (VSTS), builds that depend on that package will start to fail. You won't be able to repush that package to the feed because of immutability. In order to recover the package and have builds start working again, you can recover it from the Recycle Bin.

  1. Find the Recycle Bin in the Packages page underneath the Build and Release hub in VSTS:

    Visual Studio Team Services Recycle Bin

    Once in the Recycle Bin, you will see any packages that have been deleted from the current feed in the past 30 days.

  2. Click a package to get more details such as: Version, Deleted date/time, and Scheduled permanent deletion:

    Visual Studio Team Services Recycle Bin package view

  3. Select a version to Restore to feed:

    Restore a VSTS package with Recycle Bin