In Azure DevOps, I'd like to use the dotnet core CLI task to push a package with the --skip-duplicate option set. How do I do that?
I tried to set arguments: --skip-duplicate
, but that's not getting reflected in the executed command.
I tried custom command with custom: nuget push
, but that indicates nuget push isn't a valid custom command.
How do I make the DotNetCorCLI@2 task perform dotnet nuget push <pathspec> --skip-duplicate
(with also the --source
option set to an internal package source)
Step 1. Create a new feed in MyGet that you would like to serve as your target package repository on MyGet. Navigate to the “Feed Details” menu from the left, and identify the values unique to your feed under “Push NuGet Packages to” and “API key.” Step 2.
The dotnet nuget push command pushes a package to the server and publishes it. The push command uses server and credential details found in the system's NuGet config file or chain of config files. For more information on config files, see Configuring NuGet Behavior.
Try to use custom: nuget
and put the push
in argument. Check the following syntax:
steps:
- task: DotNetCoreCLI@2
displayName: 'dotnet nuget push'
inputs:
command: custom
custom: nuget
arguments: 'push *.nupkg -s https://pkgs.dev.azure.com/xxxx/_packaging/xxx/nuget/v3/index.json --skip-duplicate'
You should be able to use the nuget authenticate and the nuget push instead of the dotnet core CLI. It has a couple of more features
- task: NuGetAuthenticate@0
displayName: 'NuGet Authenticate'
- task: NuGetCommand@2
displayName: 'NuGet push'
inputs:
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg'
command: push
feedsToUse: 'select'
publishVstsFeed: 'feedname'
allowPackageConflicts: true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With