diff --git a/eng/cibuild_bootstrapped_msbuild.ps1 b/eng/cibuild_bootstrapped_msbuild.ps1 index e2473d73225..8154c3312b6 100644 --- a/eng/cibuild_bootstrapped_msbuild.ps1 +++ b/eng/cibuild_bootstrapped_msbuild.ps1 @@ -84,9 +84,10 @@ try { } else { - $buildToolPath = Join-Path $bootstrapRoot "core\dotnet.exe" - # The version must be consistent with BootstrapSdkVersion - $buildToolCommand = Join-Path $bootstrapRoot "core\sdk\9.0.200-preview.0.24523.19\MSBuild.dll" + $buildToolPath = "$bootstrapRoot\core\dotnet.exe" + $propsFile = Join-Path $PSScriptRoot "Versions.props" + $bootstrapSdkVersion = ([xml](Get-Content $propsFile)).SelectSingleNode("//PropertyGroup/BootstrapSdkVersion").InnerText + $buildToolCommand = "$bootstrapRoot\core\sdk\$bootstrapSdkVersion\MSBuild.dll" $buildToolFramework = "net9.0" } diff --git a/eng/cibuild_bootstrapped_msbuild.sh b/eng/cibuild_bootstrapped_msbuild.sh index 2b8bd23026b..13d48b6da57 100755 --- a/eng/cibuild_bootstrapped_msbuild.sh +++ b/eng/cibuild_bootstrapped_msbuild.sh @@ -58,9 +58,12 @@ bootstrapRoot="$Stage1Dir/bin/bootstrap" if [ $host_type = "core" ] then - _InitializeBuildTool="$bootstrapRoot/core/dotnet" - # The version must be consistent with BootstrapSdkVersion - _InitializeBuildToolCommand="$bootstrapRoot/core/sdk/9.0.200-preview.0.24523.19/MSBuild.dll" + 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') + + _InitializeBuildTool="${bootstrapRoot}/core/dotnet" + _InitializeBuildToolCommand="${bootstrapRoot}/core/sdk/${sdk_version}/MSBuild.dll" _InitializeBuildToolFramework="net9.0" else echo "Unsupported hostType ($host_type)"