Search code examples
visual-studionuget

NuGet Fails to Update


I am in VS 2022 and I have a project that I need to update. I have a reference to a version 0.10.871 of one of my packages that lives on a custom NuGet feed in Azure DevOps. It's not been updated for a while and this version dropped off of the history so it's not available anymore in my feed - latest version is 0.10.903. I got a new machine so it's not cached anymore. Now when I try to do a NuGet restore I get this message:

An error occurred while trying to restore packages: Unable to find version '0.10.871'...

and then it goes on to say the different places it looked.

That's fine, but then I try to go to that package and I see the updated version listed, but when I try to install the updated version it just things for a few seconds and then gives me the same message. I've tried this with NuGet set to the custom feed where it lives and to 'All' with the same result.

So how do I get the updated version if the current version doesn't exist anymore and it wants that current version in order to install the updated version??


Solution

  • Since you mentioned you are using Azure DevOps feed and the version has been dropped off, then the issue you encountered is expected.

    First, from the Azure DevOps side, there are two situation.

    1, Unlist.

    If the version was unlisted, just relist it again and then you will be able to use it.

    2, Delete

    If the version was been deleted, then by default the version will be in soft-deleted status for 30 days, during the soft-deleted days, you could restore the version in the Recycle Bin:

    enter image description here

    after that, the version will be able to use again.

    But if the time is more than 30 days, the deleted version will be unable to be restored again, the data is permanently removed from the database at this time.


    Second, from the client side

    If the version in Azure DevOps feed is unable to be used again, then as others said, you could use .csproj and packages.config to use other available versions.

    Here are the official document of those files:

    PackageReference in project files

    packages.config reference