Skip to content

Commit 020c086

Browse files
committed
ignore errors when first attempting to find dotnet executable
set failure of finding dotnet as a warning, we will attempt to install it during bootstrap this handles the case of a blank slate where dotnet has never been installed
1 parent b3d23cf commit 020c086

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

build.psm1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ function Receive-DotnetInstallScript
480480

481481
function Get-DotnetExe
482482
{
483-
$discoveredDotNet = Get-Command -CommandType Application dotnet
483+
$discoveredDotNet = Get-Command -CommandType Application dotnet -ErrorAction SilentlyContinue
484484
if ( $discoveredDotNet ) {
485485
$discoveredDotNet | Select-Object -First 1 | Foreach-Object { $_.Source }
486486
return
@@ -499,6 +499,7 @@ function Get-DotnetExe
499499
return $dotnetHuntPath
500500
}
501501
}
502-
throw "Could not find dotnet executable"
502+
Write-Warning "Could not find dotnet executable"
503+
return [String]::Empty
503504
}
504505
$script:dotnetExe = Get-DotnetExe

0 commit comments

Comments
 (0)