From 504e762e17b1fe746328cf026c9922590eeb1753 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 5 May 2026 16:20:44 +0000 Subject: [PATCH 1/2] Initial plan From fdb48d45d0de387469b69fb6a4cc20c87418c153 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 5 May 2026 16:24:56 +0000 Subject: [PATCH 2/2] Auto-derive BootstrapSdkVersion from global.json tools.dotnet Agent-Logs-Url: https://github.com/dotnet/msbuild/sessions/8519415e-ce9b-4854-8348-2c215f5d4c4c Co-authored-by: OvesN <150850103+OvesN@users.noreply.github.com> --- eng/Versions.props | 3 ++- eng/cibuild_bootstrapped_msbuild.ps1 | 7 +++++-- eng/cibuild_bootstrapped_msbuild.sh | 15 +++++++++++++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 7bcfb77feaa..cac33845c9c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -81,7 +81,8 @@ - 10.0.106 + + $(DotNetCliVersion) diff --git a/eng/cibuild_bootstrapped_msbuild.ps1 b/eng/cibuild_bootstrapped_msbuild.ps1 index a61ecbe7d4a..30420ffb487 100644 --- a/eng/cibuild_bootstrapped_msbuild.ps1 +++ b/eng/cibuild_bootstrapped_msbuild.ps1 @@ -85,8 +85,11 @@ try { else { $buildToolPath = "$bootstrapRoot\core\dotnet.exe" - $propsFile = Join-Path $PSScriptRoot "Versions.props" - $bootstrapSdkVersion = ([xml](Get-Content $propsFile)).SelectSingleNode("//PropertyGroup/BootstrapSdkVersion").InnerText + $globalJsonPath = Join-Path $PSScriptRoot "..\global.json" + $bootstrapSdkVersion = (Get-Content $globalJsonPath -Raw | ConvertFrom-Json).tools.dotnet + if ([string]::IsNullOrWhiteSpace($bootstrapSdkVersion)) { + throw "Could not read tools.dotnet from $globalJsonPath." + } $buildToolCommand = "$bootstrapRoot\core\sdk\$bootstrapSdkVersion\MSBuild.dll" $buildToolFramework = "net" diff --git a/eng/cibuild_bootstrapped_msbuild.sh b/eng/cibuild_bootstrapped_msbuild.sh index 10c1f8af56f..c06d7558fbb 100755 --- a/eng/cibuild_bootstrapped_msbuild.sh +++ b/eng/cibuild_bootstrapped_msbuild.sh @@ -69,8 +69,19 @@ bootstrapRoot="$Stage1Dir/bin/bootstrap" if [ $host_type = "core" ] then script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - props_file="$script_dir/Versions.props" - sdk_version=$(grep -A1 "BootstrapSdkVersion" "$props_file" | grep -o ">.*<" | sed 's/[><]//g') + global_json="$script_dir/../global.json" + # Prefer jq for proper JSON parsing; fall back to grep/sed on environments where jq is not installed. + # The grep/sed fallback matches the first "dotnet": "..." value in global.json, which in practice + # is always tools.dotnet since that is the only top-level "dotnet" key in the file. + if command -v jq &> /dev/null; then + sdk_version=$(jq -r '.tools.dotnet' "$global_json") + else + sdk_version=$(grep -o '"dotnet"[[:space:]]*:[[:space:]]*"[^"]*"' "$global_json" | head -1 | sed 's/.*"dotnet"[[:space:]]*:[[:space:]]*"\([^"]*\)"/\1/') + fi + if [ -z "$sdk_version" ] || [ "$sdk_version" = "null" ]; then + echo "ERROR: Could not read tools.dotnet from $global_json." >&2 + exit 1 + fi _InitializeBuildTool="${bootstrapRoot}/core/dotnet" _InitializeBuildToolCommand="${bootstrapRoot}/core/sdk/${sdk_version}/MSBuild.dll"