Reputation: 1569
I am a bit stuck in here and might need some help to understand this process with azure pipeline.
I have this pipeline:
steps:
- task: DotNetCoreCLI@2
displayName: 'DotNet - Restore'
inputs:
command: 'restore'
projects: '**/*.csproj'
noCache: true
versioningScheme: 'off'
vstsFeed: 'my-feed'
- task: DotNetCoreCLI@2
displayName: 'DotNet - Pack'
inputs:
command: 'pack'
packagesToPack: '**/*.csproj'
versioningScheme: 'off'
- task: DotNetCoreCLI@2
displayName: 'DotNet - Push'
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: 'my-feed'
This pipeline takes roughly 6mins to run, when I check the details of the pipeline, I see that the tasks that take the most are the restore and pack.
When I check the output of those task, I am pretty sure that the pipeline, is building and restoring in the first step, this:
- task: DotNetCoreCLI@2
displayName: 'DotNet - Restore'
inputs:
command: 'restore'
projects: '**/*.csproj'
noCache: true
versioningScheme: 'off'
vstsFeed: 'my-feed'
and when I check the Pack I see the same thing
- task: DotNetCoreCLI@2
displayName: 'DotNet - Pack'
inputs:
command: 'pack'
packagesToPack: '**/*.csproj'
versioningScheme: 'off'
I checked the azure documentation, but I couldn't find any explanation about the steps for pack steps and if it comes with a Restore.
Can anyone shade some light on this?..if I get rid of the Restore, the project will be Restored anyway as part of the pack?
I want to cut the build time of this pipeline.
Thank you so much for any help or explanation.
Upvotes: 0
Views: 1059
Reputation: 59055
The documentation for dotnet pack
clearly explains the behavior:
You don't have to run
dotnet restore
because it's run implicitly by all commands that require a restore to occur, such asdotnet new
,dotnet build
,dotnet run
,dotnet test
,dotnet publish
, anddotnet pack
. To disable implicit restore, use the--no-restore
option.
Emphasis mine.
Upvotes: 1