From eed6c2fd5b6f362a09cc487f8b265bd39e87bc60 Mon Sep 17 00:00:00 2001 From: Logan Bussell Date: Mon, 11 May 2026 13:28:04 -0700 Subject: [PATCH] Fix ImageBuilder test toolset resolution Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/run-tests.ps1 | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/run-tests.ps1 b/src/run-tests.ps1 index ed86a167c..bd3302cec 100644 --- a/src/run-tests.ps1 +++ b/src/run-tests.ps1 @@ -38,8 +38,23 @@ try { $globalJson = Get-Content (Join-Path $repoRoot 'global.json') | ConvertFrom-Json $arcadeSdkVersion = $globalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk' # Need to use nested Join-Path calls to support Windows PowerShell, which doesn't support multiple paths in a single Join-Path call - $toolsetLocationFile = Join-Path (Join-Path (Join-Path $repoRoot 'artifacts') 'toolset') "$arcadeSdkVersion.txt" - $buildProj = Get-Content $toolsetLocationFile -TotalCount 1 + $toolsetDir = Join-Path (Join-Path (Join-Path $repoRoot 'artifacts') 'toolset') $arcadeSdkVersion + $toolsetBuildProj = Join-Path $toolsetDir 'Build.proj' + $buildProj = $toolsetBuildProj + + if (-not (Test-Path $buildProj)) { + $toolsetLocationFile = Join-Path (Join-Path (Join-Path $repoRoot 'artifacts') 'toolset') "$arcadeSdkVersion.txt" + if (Test-Path $toolsetLocationFile) { + $legacyBuildProj = Get-Content $toolsetLocationFile -TotalCount 1 + if (-not [string]::IsNullOrWhiteSpace($legacyBuildProj)) { + $buildProj = $legacyBuildProj + } + } + } + + if ([string]::IsNullOrWhiteSpace($buildProj) -or -not (Test-Path $buildProj)) { + throw "Failed to locate Arcade toolset Build.proj. Expected '$toolsetBuildProj'." + } $dotnet = Join-Path $dotnetInstallDir 'dotnet' & $dotnet msbuild $buildProj /p:Restore=true /p:Build=false /p:RepoRoot="$repoRoot/" /clp:NoSummary