Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
</PropertyGroup>

<PropertyGroup>
<BootstrapSdkVersion>10.0.106</BootstrapSdkVersion>
<!-- Derived from global.json so it can never lag tools.dotnet -->
<BootstrapSdkVersion>$(DotNetCliVersion)</BootstrapSdkVersion>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What we are missing here is doing some kind of Math.Min('$(NetCoreSdkVersion)', '10.0.106'))

</PropertyGroup>

<Target Name="OverrideArcadeFileVersion" AfterTargets="_InitializeAssemblyVersion">
Expand Down
7 changes: 5 additions & 2 deletions eng/cibuild_bootstrapped_msbuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
Comment on lines +88 to +92
Copy link
Copy Markdown
Member

@ViktorHofer ViktorHofer May 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems wrong. It now always uses the SDK version from global.json. It would be better to still allow to hardcode a newer version via the BootstrapSdkVersion property but make sure that is never older than the SDK provided one.

I would use the msbuild -getproperty function here to avoid direct XML parsing and invoke some project that imports the microsoft.net.sdk, i.e. the msbuild.bootstrap.csproj.

This also applies to the bash changes.

$buildToolCommand = "$bootstrapRoot\core\sdk\$bootstrapSdkVersion\MSBuild.dll"
$buildToolFramework = "net"

Expand Down
15 changes: 13 additions & 2 deletions eng/cibuild_bootstrapped_msbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading