@@ -126,6 +126,12 @@ function InitializeDotNetCli {
126126 export DOTNET_CLI_TELEMETRY_OPTOUT=1
127127 fi
128128
129+ # Keep repo builds isolated from machine-installed SDK state and workload advertising.
130+ # This avoids preview SDK builds picking up mismatched workloads on CI images.
131+ export DOTNET_MULTILEVEL_LOOKUP=0
132+ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
133+ export DOTNET_CLI_WORKLOAD_UPDATE_NOTIFY_DISABLE=1
134+
129135 # LTTNG is the logging infrastructure used by Core CLR. Need this variable set
130136 # so it doesn't output warnings to the console.
131137 export LTTNG_HOME=" $HOME "
@@ -171,6 +177,9 @@ function InitializeDotNetCli {
171177 Write-PipelinePrependPath -path " $dotnet_root "
172178
173179 Write-PipelineSetVariable -name " DOTNET_NOLOGO" -value " 1"
180+ Write-PipelineSetVariable -name " DOTNET_MULTILEVEL_LOOKUP" -value " 0"
181+ Write-PipelineSetVariable -name " DOTNET_SKIP_FIRST_TIME_EXPERIENCE" -value " 1"
182+ Write-PipelineSetVariable -name " DOTNET_CLI_WORKLOAD_UPDATE_NOTIFY_DISABLE" -value " 1"
174183
175184 # return value
176185 _InitializeDotNetCli=" $dotnet_root "
@@ -542,7 +551,12 @@ function MSBuild-Core {
542551 warnnotaserror_switch=" /warnnotaserror:$warn_not_as_error /p:AdditionalWarningsNotAsErrors=$warn_not_as_error "
543552 fi
544553
545- RunBuildTool " $_InitializeBuildToolCommand " /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch $mt_switch $warnnotaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci " $@ "
554+ local workload_resolver_switch=" "
555+ if [[ " $ci " == true && -n " ${_InitializeBuildToolCommand:- } " ]]; then
556+ workload_resolver_switch=" /p:MSBuildEnableWorkloadResolver=false"
557+ fi
558+
559+ RunBuildTool " $_InitializeBuildToolCommand " /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch $mt_switch $warnnotaserror_switch $workload_resolver_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci " $@ "
546560}
547561
548562function GetDarc {
@@ -598,6 +612,12 @@ mkdir -p "$toolset_dir"
598612mkdir -p " $temp_dir "
599613mkdir -p " $log_dir "
600614
615+ # Direct MSBuild crash diagnostics (MSB4166 failure.txt files) to a known location
616+ # under artifacts/log so they are captured as build artifacts in CI.
617+ if [[ -z " ${MSBUILDDEBUGPATH:- } " ]]; then
618+ export MSBUILDDEBUGPATH=" $log_dir /MsbuildDebugLogs"
619+ fi
620+
601621Write-PipelineSetVariable -name " Artifacts" -value " $artifacts_dir "
602622Write-PipelineSetVariable -name " Artifacts.Toolset" -value " $toolset_dir "
603623Write-PipelineSetVariable -name " Artifacts.Log" -value " $log_dir "
0 commit comments