From 30b64ac46ec2c8d1b8f647ec0374ed70cd33ee2b Mon Sep 17 00:00:00 2001 From: Giang Nguyen Date: Fri, 15 Mar 2024 15:41:02 +0200 Subject: [PATCH] ci: Added option to specify MSBuild exe path to `build.ps1` --- build.ps1 | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/build.ps1 b/build.ps1 index 2e1a795..ee4e1bb 100644 --- a/build.ps1 +++ b/build.ps1 @@ -11,18 +11,28 @@ param ( [Parameter()] [switch] - $Test + $Test, + + [Parameter()] + $MsBuildExe ) . "$PSScriptRoot\common.ps1" -$msBuildPath = Resolve-MsBuildPath -ErrorAction Stop +# if (!$MsBuildExe) { +# $MsBuildExe = Resolve-MsBuildPath -ErrorAction Stop +# } +# else { +# $MsBuildExe = $MsBuildExe +# } + +$MsBuildExe ??= (Resolve-MsBuildPath -ErrorAction Stop) -if (!$msBuildPath) { +if (!$MsBuildExe) { throw "Could not resolve MSBuild path." } -$null = Test-Path $msBuildPath -ErrorAction Stop +$null = Test-Path $MsBuildExe -ErrorAction Stop $solution = Join-Path -Path $PSScriptRoot -ChildPath 'TwinGet.sln' @@ -30,7 +40,7 @@ if (-not $NoRestore) { dotnet restore $solution } -& $msBuildPath $solution -p:Configuration=$Configuration +& $MsBuildExe $solution -p:Configuration=$Configuration if ($Test) { dotnet test --configuration $Configuration --no-build --no-restore --logger "trx;verbosity=detailed;LogFileName=test_results.trx" $PSScriptRoot\TwinGet.sln