Skip to content

Commit 28de057

Browse files
committed
do not set host path
1 parent d46a551 commit 28de057

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

eng/build.ps1

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -734,15 +734,6 @@ try {
734734

735735
Push-Location $RepoRoot
736736

737-
# Workaround for DOTNET_HOST_PATH not being set by older MSBuild
738-
# Removal is tracked by https://github.com/dotnet/roslyn/issues/80742
739-
if (-not $env:DOTNET_HOST_PATH) {
740-
$env:DOTNET_HOST_PATH = Join-Path (Join-Path $RepoRoot '.dotnet') 'dotnet'
741-
if (-not (Test-Path $env:DOTNET_HOST_PATH)) {
742-
$env:DOTNET_HOST_PATH = "$($env:DOTNET_HOST_PATH).exe"
743-
}
744-
}
745-
746737
Subst-TempDir
747738

748739
if ($ci) {
@@ -759,6 +750,18 @@ try {
759750
&(Ensure-DotNetSdk) tool restore
760751
}
761752

753+
# Above InitializeDotNetCli or Ensure-DotNetSdk may have installed a local .NET SDK (stored in global:_DotNetInstallDir).
754+
# We need to make sure DOTNET_HOST_PATH points to that SDK as a workaround for older MSBuild
755+
# which will not set it correctly. Removal is tracked by https://github.com/dotnet/roslyn/issues/80742
756+
if (-not $env:DOTNET_HOST_PATH -and (Test-Path variable:global:_DotNetInstallDir)) {
757+
$env:DOTNET_HOST_PATH = Join-Path $global:_DotNetInstallDir 'dotnet'
758+
if (-not (Test-Path $env:DOTNET_HOST_PATH)) {
759+
$env:DOTNET_HOST_PATH = "$($env:DOTNET_HOST_PATH).exe"
760+
}
761+
762+
Write-Host "Setting DOTNET_HOST_PATH to $env:DOTNET_HOST_PATH"
763+
}
764+
762765
if ($bootstrap -and $bootstrapDir -eq "") {
763766
Write-Host "Building bootstrap Compiler"
764767
$bootstrapDir = Join-Path (Join-Path $ArtifactsDir "bootstrap") "build"

0 commit comments

Comments
 (0)