diff --git a/init.ps1 b/init.ps1 index 5bace1e6..6211304f 100755 --- a/init.ps1 +++ b/init.ps1 @@ -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