File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff 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"
You can’t perform that action at this time.
0 commit comments