From 3ab83e3b368d79cddf8f8c2a2889e56661dbd593 Mon Sep 17 00:00:00 2001 From: Paul Higinbotham Date: Thu, 27 Jan 2022 09:02:02 -0800 Subject: [PATCH] Update release build image --- .ci/ci_auto.yml | 4 ++-- .ci/ci_release.yml | 4 ++-- .ci/release.yml | 2 +- doBuild.ps1 | 20 +++++++++++++++++++- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/.ci/ci_auto.yml b/.ci/ci_auto.yml index 658f10aae..78090b56d 100644 --- a/.ci/ci_auto.yml +++ b/.ci/ci_auto.yml @@ -32,7 +32,7 @@ stages: pool: name: 1ES demands: - - ImageOverride -equals MMS2019 + - ImageOverride -equals PSMMS2019-Secure steps: @@ -275,7 +275,7 @@ stages: pool: name: 1ES demands: - - ImageOverride -equals MMS2019 + - ImageOverride -equals PSMMS2019-Secure steps: - checkout: self diff --git a/.ci/ci_release.yml b/.ci/ci_release.yml index ce6a61901..e3865843d 100644 --- a/.ci/ci_release.yml +++ b/.ci/ci_release.yml @@ -21,7 +21,7 @@ stages: pool: name: 1ES demands: - - ImageOverride -equals MMS2019 + - ImageOverride -equals PSMMS2019-Secure steps: @@ -281,7 +281,7 @@ stages: pool: name: 1ES demands: - - ImageOverride -equals MMS2019 + - ImageOverride -equals PSMMS2019-Secure steps: - checkout: self diff --git a/.ci/release.yml b/.ci/release.yml index 6c8527990..3d73c0795 100644 --- a/.ci/release.yml +++ b/.ci/release.yml @@ -7,7 +7,7 @@ jobs: pool: name: 1ES demands: - - ImageOverride -equals MMS2019 + - ImageOverride -equals PSMMS2019-Secure displayName: ${{ parameters.displayName }} steps: diff --git a/doBuild.ps1 b/doBuild.ps1 index a2a3f7044..98f1edc08 100644 --- a/doBuild.ps1 +++ b/doBuild.ps1 @@ -50,10 +50,28 @@ function DoBuild # Build code and place it in the staging location Push-Location "${SrcPath}/code" try { + # Get dotnet.exe command path. + $dotnetCommand = Get-Command -Name 'dotnet' -ErrorAction Ignore + + # Check for dotnet for Windows (we only build on Windows platforms). + if ($null -eq $dotnetCommand) { + Write-Verbose -Verbose -Message "dotnet.exe cannot be found in current path. Looking in ProgramFiles path." + $dotnetCommandPath = Join-Path -Path $env:ProgramFiles -ChildPath "dotnet\dotnet.exe" + $dotnetCommand = Get-Command -Name $dotnetCommandPath -ErrorAction Ignore + if ($null -eq $dotnetCommand) { + throw "Dotnet.exe cannot be found: $dotnetCommandPath is unavailable for build." + } + } + + Write-Verbose -Verbose -Message "dotnet.exe command found in path: $($dotnetCommand.Path)" + + # Check dotnet version + Write-Verbose -Verbose -Message "DotNet version: $(& ($dotnetCommand) --version)" + # Build source Write-Verbose -Verbose -Message "Building with configuration: $BuildConfiguration, framework: $BuildFramework" Write-Verbose -Verbose -Message "Build location: PSScriptRoot: $PSScriptRoot, PWD: $pwd" - dotnet publish --configuration $BuildConfiguration --framework $BuildFramework --output $BuildSrcPath -warnaserror + & ($dotnetCommand) publish --configuration $BuildConfiguration --framework $BuildFramework --output $BuildSrcPath -warnaserror if ($LASTEXITCODE -ne 0) { throw "Build failed with exit code: $LASTEXITCODE" }