From 4f90c72fcaa142881e954e4cab61ad71f35aa315 Mon Sep 17 00:00:00 2001 From: Jaime Bernardo Date: Mon, 14 Oct 2024 09:58:40 +0100 Subject: [PATCH] Have the script show error on dotnet tool failure --- .pipelines/applyXamlStyling.ps1 | 6 ++++++ .pipelines/verifyNugetPackages.ps1 | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/.pipelines/applyXamlStyling.ps1 b/.pipelines/applyXamlStyling.ps1 index 8a9dd1b1df..8a6975ed0b 100644 --- a/.pipelines/applyXamlStyling.ps1 +++ b/.pipelines/applyXamlStyling.ps1 @@ -40,6 +40,12 @@ Write-Output "Use 'Help .\applyXamlStyling.ps1' for more info or '-Main' to run Write-Output "" Write-Output "Restoring dotnet tools..." dotnet tool restore --disable-parallel --no-cache +if ($lastExitCode -ne 0) +{ + $result = $lastExitCode + Write-Error 'Error running dotnet tool. Please verify the environment the script is running on.' + exit $result +} if (-not $Passive) { diff --git a/.pipelines/verifyNugetPackages.ps1 b/.pipelines/verifyNugetPackages.ps1 index 1fcc5237f0..bf22aab7a3 100644 --- a/.pipelines/verifyNugetPackages.ps1 +++ b/.pipelines/verifyNugetPackages.ps1 @@ -7,6 +7,13 @@ Param( Write-Host "Verifying Nuget packages for $solution" dotnet tool restore +if ($lastExitCode -ne 0) +{ + $result = $lastExitCode + Write-Error 'Error running dotnet tool. Please verify the environment the script is running on.' + exit $result +} + dotnet consolidate -s $solution if (-not $?)