Reputation: 1856
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'
Upvotes: 1
Views: 503
Reputation: 61
The pack
command "builds the project and creates NuGet packages", that's why it is trying to restore the packages again.
To prevent this, add nobuild: true
to the task inputs:
- task: @DotNetCoreCLI@2
displayName: Pack
inputs:
command: pack
nobuild: true
It will no longer try to rebuild the project itself, but instead use the artifacts created in previous steps.
Upvotes: 2
Reputation: 41715
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.
Upvotes: 1