overwrite nuget packages in feed on visual studio team services
Asked Answered
C

4

21

while using

nuget.exe push \\share\Packages\*.nupkg -Source "https://myvsts.pkgs.visualstudio.com/_packaging/tcpcm/nuget/v3/index.json" -ApiKey VSTS

i got an

Response status code does not indicate success: 409 (Conflict).

error

is there a way to overwrite all packages that have already been uploaded?

Coarse answered 30/6, 2017 at 10:47 Comment(0)
S
36

is there a way to overwrite all packages that have already been uploaded?

The simple answer is No. Jonathan Myers`s answer pointed out the correct document: Understand immutability of packages.

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.

That because many package clients, including NuGet, keep a local cache of packages on your machine. Once a client has cached a particular package@version, it will return that copy on future install/restore requests. If, on the server, you replace package@version (rev 1) with a new package@version (rev 2), the client is unable to tell the difference. This can lead to indeterminate build results from different machines.

So we could not overwrite all packages that have already been uploaded, even we could not delete them and re-uploaded. To resolve this issue, the only way is that upload the packages with a new version.

Subcritical answered 3/7, 2017 at 3:22 Comment(2)
ok thanks for the info, what i now did was to upload all packages to source code and then create a build definition for nuget push. it pushes all packages and the build task also allowes to skip packages that are already installed, pretty handy.Coarse
What would be the proper (convenient) way for developing and testing packages then? @IngoB did you figure it out? Should I really release a minor version number every time I package and test a lib? I'm just pushing to a local folder locally on my machine.Margrettmarguerie
A
6

This is intentionally prohibited in VSTS.

Aesir answered 30/6, 2017 at 14:19 Comment(0)
H
5

Try adding ?replace=true at the end of the URL. Alternatively you could try AllowOverwriteExistingPackages=true.

I'm not sure if visualstudio.com already supports this, but this is how it's working in case of Octopus Deploy's NuGet server.

Hypnology answered 30/6, 2017 at 10:56 Comment(5)
hey there, thanks for the info, i've already tryed both but they are not supportedCoarse
is there a way to bulk delete all packages so i can push them again?Coarse
@IngoB In my experience, deleting a package v1.1 off the feed, you still cannot upload a revised v1.1.Memento
Just to confirm, I see the same behavior on Octopus NuGet server.Armitage
You can always download every package, then rename the feed, wait a few mins, create a new feed with the old name, then push all the packages except the one that you don't want - get a new set of immutable version numbers so to speak. :SGraphics
A
0

Probably not the best practice but if you need to update same version then you can always delete a package first and then push updated one with the same version.

NuGet delete command

Aussie answered 7/12, 2022 at 15:51 Comment(1)
This doesn't work. See top-rated answer.Syllogize

© 2022 - 2024 — McMap. All rights reserved.