.net-coreazure-devopsyamlazure-pipelinesasp.net-core-cli

Azure DevOps YAML - .Net Core CLI can't pack using internal artifact feed


I'm trying to restore, build, pack and push in Azure DevOps with .Net Core CLI using YAML.

Restore has knowledge of the internal feed, however pack doesn't.

How can i add the internal feed to the pack operation?

parameters:
  projects: ''

steps:
- task: DotNetCoreCLI@2
  displayName: "ProvisionRestoreProjects"
  inputs:
    command: 'restore'
    projects: '${{ parameters.projects }}'
    feedsToUse: 'select'
    vstsFeed: '/4d73414a-a21f-4f84-9355-90beadaf0a6e'

- task: DotNetCoreCLI@2
  displayName: "ProvisionBuildProjects"
  inputs:
    command: 'build'
    projects: ${{ parameters.projects }}
    arguments: '--configuration release  --no-cache'

- task: DotNetCoreCLI@2
  displayName: "ProvisionPackProjects" 
  inputs:
    command: 'pack'
    projects: ${{ parameters.projects }}
    versioningScheme: 'byEnvVar'
    versionEnvVar: 'NugetVersion'
    feedsToUse: 'select'
    vstsFeed: '/4d73414a-a21f-4f84-9355-90beadaf0a6e'

- task: DotNetCoreCLI@2
  displayName: "ProvisionPushProjects"
  inputs:
    command: 'push'
    packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
    feedsToUse: 'select'
    vstsFeed: '/4d73414a-a21f-4f84-9355-90beadaf0a6e'

Solution

  • You don't need to specify a feed in the pack command.

    The pack command is only to pack the files to .nupkg file (NuGet package), then you push it to your feed.

    More info about the command and which options can be used you can fine here.