I have an Azure DevOps pipeline for one of my .Net Core projects. I would like to encapsulate as much of the build process as possible so I can run builds on my local machine, so I have the steps of restore, compile, test, publish, etc. encapsulated in a build script which I call from my Azure DevOps pipeline.
The .Net Core CLI task automatically handles authentication to Azure Artifacts feeds, which is great when you want to script out your build in your pipeline, but I really want to add a task which only does the authentication part and passes off responsibility for everything else to my build script. Is there some way to authenticate without doing a restore?
Here's the relevant portion of my pipeline:
- task: DotNetCoreCLI@2
displayName: 'NuGet Authentiation and Restore'
inputs:
command: 'restore'
projects: 'src/*.sln'
feedsToUse: 'select'
vstsFeed: '5483129a-4405-40c1-8ccb-a688120b3137'
includeNuGetOrg: false
- task: Npm@1
displayName: 'Build release distribution'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
command: custom
verbose: false
customCommand: 'run build'
The npm run build
step will call dotnet restore
which succeeds because the packages are already restored, but I'm really just using the DotnetCoreCLI task for it's authentication ability. I don't really want it to restore. I mean, it works, but it just feels messy.