Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do I use "nuget push" with the --skip-duplicate option in task DotNetCoreCLI@2

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)

like image 559
Martijn Avatar asked Jun 10 '20 14:06

Martijn


People also ask

How do I push a package to MyGet?

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.

What is NuGet push?

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.


2 Answers

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'
like image 57
Cece Dong - MSFT Avatar answered Sep 22 '22 20:09

Cece Dong - MSFT


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
like image 27
Frederik Vigen Avatar answered Sep 22 '22 20:09

Frederik Vigen