@@ -168,6 +168,12 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) {
168168 $env: DOTNET_CLI_TELEMETRY_OPTOUT = 1
169169 }
170170
171+ # Keep repo builds isolated from machine-installed SDK state and workload advertising.
172+ # This avoids preview SDK builds picking up mismatched workloads on CI images.
173+ $env: DOTNET_MULTILEVEL_LOOKUP = ' 0'
174+ $env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE = ' 1'
175+ $env: DOTNET_CLI_WORKLOAD_UPDATE_NOTIFY_DISABLE = ' 1'
176+
171177 # Find the first path on %PATH% that contains the dotnet.exe
172178 if ($useInstalledDotNetCli -and (-not $globalJsonHasRuntimes ) -and ($env: DOTNET_INSTALL_DIR -eq $null )) {
173179 $dotnetExecutable = GetExecutableFileName ' dotnet'
@@ -230,6 +236,9 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) {
230236 Write-PipelinePrependPath - Path $dotnetRoot
231237
232238 Write-PipelineSetVariable - Name ' DOTNET_NOLOGO' - Value ' 1'
239+ Write-PipelineSetVariable - Name ' DOTNET_MULTILEVEL_LOOKUP' - Value ' 0'
240+ Write-PipelineSetVariable - Name ' DOTNET_SKIP_FIRST_TIME_EXPERIENCE' - Value ' 1'
241+ Write-PipelineSetVariable - Name ' DOTNET_CLI_WORKLOAD_UPDATE_NOTIFY_DISABLE' - Value ' 1'
233242
234243 return $global :_DotNetInstallDir = $dotnetRoot
235244}
@@ -619,11 +628,7 @@ function GetSdkTaskProject([string]$taskName) {
619628 if (Test-Path $proj ) {
620629 return $proj
621630 }
622- # TODO: Remove this fallback once all supported versions use the new layout.
623- $legacyProj = Join-Path $toolsetDir " SdkTasks\$taskName .proj"
624- if (Test-Path $legacyProj ) {
625- return $legacyProj
626- }
631+
627632 throw " Unable to find $taskName .proj in toolset at: $toolsetDir "
628633}
629634
@@ -699,23 +704,14 @@ function InitializeToolset() {
699704
700705 $packageDir = Join-Path $nugetCache (Join-Path ' microsoft.dotnet.arcade.sdk' $toolsetVersion )
701706 $packageToolsetDir = Join-Path $packageDir ' toolset'
702- $packageToolsDir = Join-Path $packageDir ' tools'
703707
704- # TODO: Remove the tools/ check once all supported versions have the toolset folder.
705- if (! (Test-Path $packageToolsetDir ) -and ! (Test-Path $packageToolsDir )) {
708+ if (! (Test-Path $packageToolsetDir )) {
706709 Write-PipelineTelemetryError - Category ' InitializeToolset' - Message " Arcade SDK package does not contain a toolset or tools folder: $packageDir "
707710 ExitWithExitCode 3
708711 }
709712
710713 New-Item - ItemType Directory - Path $toolsetToolsDir - Force | Out-Null
711-
712- # Copy toolset if present at the package root (new layout), otherwise fall back to tools
713- if (Test-Path $packageToolsetDir ) {
714- Copy-Item - Path " $packageToolsetDir \*" - Destination $toolsetToolsDir - Recurse - Force
715- } else {
716- # TODO: Remove this fallback once all supported versions have the toolset folder.
717- Copy-Item - Path " $packageToolsDir \*" - Destination $toolsetToolsDir - Recurse - Force
718- }
714+ Copy-Item - Path " $packageToolsetDir \*" - Destination $toolsetToolsDir - Recurse - Force
719715
720716 if (Test-Path $buildProjPath ) {
721717 $toolsetBuildProj = $buildProjPath
@@ -842,6 +838,10 @@ function MSBuild-Core() {
842838
843839 $cmdArgs = " $ ( $buildTool.Command ) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci "
844840
841+ if ($ci -and $buildTool.Tool -eq ' dotnet' ) {
842+ $cmdArgs += ' /p:MSBuildEnableWorkloadResolver=false'
843+ }
844+
845845 # Add -mt flag for MSBuild multithreaded mode if enabled via environment variable
846846 if ($env: MSBUILD_MT_ENABLED -eq " 1" ) {
847847 $cmdArgs += ' -mt'
@@ -952,6 +952,12 @@ Create-Directory $ToolsetDir
952952Create- Directory $TempDir
953953Create- Directory $LogDir
954954
955+ # Direct MSBuild crash diagnostics (MSB4166 failure.txt files) to a known location
956+ # under artifacts/log so they are captured as build artifacts in CI.
957+ if (-not $env: MSBUILDDEBUGPATH ) {
958+ $env: MSBUILDDEBUGPATH = Join-Path $LogDir ' MsbuildDebugLogs'
959+ }
960+
955961Write-PipelineSetVariable - Name ' Artifacts' - Value $ArtifactsDir
956962Write-PipelineSetVariable - Name ' Artifacts.Toolset' - Value $ToolsetDir
957963Write-PipelineSetVariable - Name ' Artifacts.Log' - Value $LogDir
0 commit comments