Skip to content

Commit

Permalink
Install tools except when -NoToolRestore is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Mar 28, 2023
1 parent 1469941 commit 3f1e858
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions init.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
No effect if -NoPrerequisites is specified.
.PARAMETER NoRestore
Skips the package restore step.
.PARAMETER NoToolRestore
Skips the dotnet tool restore step.
.PARAMETER AccessToken
An optional access token for authenticating to Azure Artifacts authenticated feeds.
.PARAMETER Interactive
Expand All @@ -46,6 +48,8 @@ Param (
[Parameter()]
[switch]$NoRestore,
[Parameter()]
[switch]$NoToolRestore,
[Parameter()]
[string]$AccessToken,
[Parameter()]
[switch]$Interactive
Expand Down Expand Up @@ -91,11 +95,13 @@ try {
if ($lastexitcode -ne 0) {
throw "Failure while restoring packages."
}
}

dotnet tool restore @RestoreArguments
if ($lastexitcode -ne 0) {
throw "Failure while restoring dotnet CLI tools."
}
if (!$NoToolRestore -and $PSCmdlet.ShouldProcess("dotnet tool", "restore")) {
dotnet tool restore @RestoreArguments
if ($lastexitcode -ne 0) {
throw "Failure while restoring dotnet CLI tools."
}
}

& "$PSScriptRoot/tools/Set-EnvVars.ps1" -Variables $EnvVars -PrependPath $PrependPath | Out-Null
Expand Down

0 comments on commit 3f1e858

Please sign in to comment.