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:]')