I got a build in VSTS that are triggered on every commit in the repository. Everything works great with one exception.
We do not release a new version of the nuget package on every commit. So our nuget push build step fails with http status code 409. I've configured that step so that it can continue anyway.
Due to the error the build is just "partially successful". I'm using the a build badge which also states the same (without context).
How can I tell VSTS to ignore 409 or just replace the existing package (on nuget.org)?
Use
-skipDuplicate
flag (available since NuGet 5.1):Source: https://docs.microsoft.com/en-us/nuget/reference/cli-reference/cli-ref-push#options
You can’t ignore 409 error in VSTS build and can’t replace the existing package in server.
I recommend that you can push the package in the release and fail the release if package is existing.
Another way is that, you can check the package in server before push package (e.g. PowerShell, REST API) during the build and set the condition for push package task (Custom Condition).
For example:
Update:
Allow duplicates to be skipped is supported in NuGet Push Task now! (Just check Allow duplicates to be skipped option in NuGet Push task.