Install tools except when `-NoToolRestore` is specified

This commit is contained in:
Andrew Arnott 2023-03-28 16:34:38 -06:00
Родитель 14699417fb
Коммит 3f1e85823f
1 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -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
@ -46,6 +48,8 @@ Param (
[Parameter()]
[switch]$NoRestore,
[Parameter()]
[switch]$NoToolRestore,
[Parameter()]
[string]$AccessToken,
[Parameter()]
[switch]$Interactive
@ -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