Ignore last exit code in the build step as dotnet may return error when SDK is not installed (#11972)

This commit is contained in:
Aditya Patwardhan 2020-02-27 17:23:55 -08:00 committed by GitHub
parent c97f2d7fd7
commit 91c9be996a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -342,7 +342,7 @@ function Start-PSBuild {
}
# Verify if the dotnet in-use is the required version
$dotnetCLIInstalledVersion = (dotnet --version)
$dotnetCLIInstalledVersion = Start-NativeExecution -sb { dotnet --version } -IgnoreExitcode
If ($dotnetCLIInstalledVersion -ne $dotnetCLIRequiredVersion) {
Write-Warning @"
The currently installed .NET Command Line Tools is not the required version.
@ -1837,7 +1837,7 @@ function Start-PSBootstrap {
$dotNetExists = precheck 'dotnet' $null
$dotNetVersion = [string]::Empty
if($dotNetExists) {
$dotNetVersion = (dotnet --version)
$dotNetVersion = Start-NativeExecution -sb { dotnet --version } -IgnoreExitcode
}
if(!$dotNetExists -or $dotNetVersion -ne $dotnetCLIRequiredVersion -or $Force.IsPresent) {
@ -2017,7 +2017,7 @@ function Find-Dotnet() {
if (precheck dotnet) {
# Must run from within repo to ensure global.json can specify the required SDK version
Push-Location $PSScriptRoot
$dotnetCLIInstalledVersion = (dotnet --version)
$dotnetCLIInstalledVersion = Start-NativeExecution -sb { dotnet --version } -IgnoreExitcode
Pop-Location
if ($dotnetCLIInstalledVersion -ne $dotnetCLIRequiredVersion) {
Write-Warning "The 'dotnet' in the current path can't find SDK version ${dotnetCLIRequiredVersion}, prepending $dotnetPath to PATH."