azure-devops-server

How Can You Replace a Package in Artifacts


We have a custom feed in Azure DevOps Server for NuGet packages. When uploading the Microsoft.AspNetCore.Authentication.Core 2.2.0 package something went wrong and now we have a bad package in our feed.

According to this question, asked and answered several years ago, it is not possible to replace the package, only increment the number and push a new version.

What are supposed to do when we don't control the version number of the package and need to replace the bad upload?

Right now, the only option we can see is to create a new feed and reupload everything from the old feed.


Solution

  • What are supposed to do when we don't control the version number of the package and need to replace the bad upload?

    As I mentioned in that thread, in order to avoid contamination of the package source, MS strictly controls the package version, does not allow upload a newer revision package with that same version number, or delete it and upload a new package at the same version.

    So, if we don't control the version number of the package and need to replace the bad upload, we have to create a new feed to save this specify package.

    BTW, if you do not want to reupload everything from the old feed, you could try following workaround:

    1. Upload the package Microsoft.AspNetCore.Authentication.Core 2.2.0 to the new feed.
    2. Delete the damaged package from the old feed.
    3. Add the new feed as upstream source for the old feed.

    Now, we could restore the nuget package from the old feed.

    Note: Do not reverse the order of step 1 and 3, otherwise you could upload the package due to the 409 conflict error.