From f2de97839a7da657f28550d3db7d35191d4fe854 Mon Sep 17 00:00:00 2001 From: Andrii Chebukin Date: Thu, 13 Aug 2026 22:54:18 +0200 Subject: [PATCH] Export DOTNET_ROOT for repo-local runtime resolution in CLI build scripts Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a88a01ae-1ee0-43a9-9735-308800e7c62d --- eng/build-utils.ps1 | 2 ++ eng/build.sh | 3 +++ 2 files changed, 5 insertions(+) diff --git a/eng/build-utils.ps1 b/eng/build-utils.ps1 index e40cf36fd9f..644171f1eb4 100644 --- a/eng/build-utils.ps1 +++ b/eng/build-utils.ps1 @@ -241,6 +241,8 @@ function Make-BootstrapBuild() { # prepare FsLex and Fsyacc and AssemblyCheck $dotnetPath = InitializeDotNetCli + # Ensure apphosts spawned by this publish see the repo-local runtime even if the caller forgot DOTNET_ROOT. + $env:DOTNET_ROOT = $dotnetPath $dotnetExe = Join-Path $dotnetPath "dotnet.exe" # prepare compiler diff --git a/eng/build.sh b/eng/build.sh index e404208df89..0ae1c1b766d 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -384,6 +384,9 @@ trap TrapAndReportError EXIT InitializeDotNetCli $restore +# Apphosts (bootstrap fsc, testhost, etc.) resolve runtimes via DOTNET_ROOT, not PATH. +export DOTNET_ROOT="$DOTNET_INSTALL_DIR" + # Resolve product TFM from centralized source of truth if not overridden via --tfm if [[ "$tfm" == "" ]]; then tfm=$("$DOTNET_INSTALL_DIR/dotnet" msbuild "$scriptroot/TargetFrameworks.props" -getProperty:FSharpNetCoreProductTargetFramework 2>/dev/null | tr -d '[:space:]')