From ca552a295d19599d9046b3805b6dfc4de218150b Mon Sep 17 00:00:00 2001 From: Jan Provaznik Date: Tue, 25 Aug 2026 13:11:29 +0200 Subject: [PATCH 1/2] Enable multithreaded MSBuild for local and PR builds Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- azure-pipelines.yml | 8 ++++++++ eng/build.ps1 | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 90e48b4363..bc014b7829 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -172,6 +172,7 @@ stages: "-NoProfile", "-File", "./eng/common/msbuild.ps1", "-prepareMachine", + "-msbuildMultiThreaded:`$true", "-warnAsError:`$false", "./TestFx.slnx", "/restore", @@ -258,6 +259,7 @@ stages: - script: eng\common\CIBuild.cmd -configuration $(_BuildConfig) + -msbuildMultiThreaded 1 -prepareMachine /p:Publish=false /p:Test=false @@ -276,6 +278,7 @@ stages: -ci ` -disablePipelineSetResult ` -configuration $(_BuildConfig) ` + -msbuildMultiThreaded $true ` -binaryLogName "$(Build.SourcesDirectory)\artifacts\log\$(_BuildConfig)\SignPack.binlog" ` -restore ` -sign ` @@ -454,6 +457,7 @@ stages: "-NoProfile", "-File", "./eng/common/msbuild.ps1", "-prepareMachine", + "-msbuildMultiThreaded:`$true", "-warnAsError:`$false", "./TestFx.slnx", "/restore", @@ -597,6 +601,7 @@ stages: "-ci", "-disablePipelineSetResult", "-configuration", "$(_BuildConfig)", + "-msbuildMultiThreaded:`$true", "-binaryLogName", "$(Build.SourcesDirectory)\artifacts\log\$(_BuildConfig)\SignPack.binlog", "-restore", "-sign", @@ -707,6 +712,7 @@ stages: # outputs; also skipped when they failed with build errors, because this step would only reproduce them. - script: eng\common\CIBuild.cmd -configuration $(_BuildConfig) + -msbuildMultiThreaded 1 -prepareMachine /p:Publish=false /p:Test=false @@ -850,6 +856,7 @@ stages: steps: - script: eng/common/cibuild.sh -configuration $(_BuildConfig) + -msbuildMultiThreaded true -prepareMachine /p:Test=false /p:Publish=false @@ -889,6 +896,7 @@ stages: steps: - script: eng/common/cibuild.sh -configuration $(_BuildConfig) + -msbuildMultiThreaded true -prepareMachine /p:Test=false /p:Publish=false diff --git a/eng/build.ps1 b/eng/build.ps1 index 8b80f374df..51251795b6 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -7,6 +7,7 @@ Param( [string] $msbuildEngine = $null, [bool] $warnAsError = $true, [bool] $nodeReuse = $true, + [bool][Alias('mt')]$msbuildMultiThreaded = $false, [switch][Alias('r')]$restore, [switch] $deployDeps, [switch][Alias('b')]$build, @@ -82,4 +83,8 @@ if ($installWindowsSdk) { $null = $PSBoundParameters.Remove("vs") $null = $PSBoundParameters.Remove("installWindowsSdk") +if (-not $PSBoundParameters.ContainsKey("msbuildMultiThreaded")) { + $PSBoundParameters["msbuildMultiThreaded"] = -not $ci +} + & $PSScriptRoot\common\Build.ps1 @PSBoundParameters From 8a675a19910d459b7e88e5b0c3318532aa7209d0 Mon Sep 17 00:00:00 2001 From: Jan Provaznik Date: Tue, 25 Aug 2026 14:37:38 +0200 Subject: [PATCH 2/2] Separate multithreaded and cached CI builds Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- azure-pipelines.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index bc014b7829..fba408e7d4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -172,7 +172,6 @@ stages: "-NoProfile", "-File", "./eng/common/msbuild.ps1", "-prepareMachine", - "-msbuildMultiThreaded:`$true", "-warnAsError:`$false", "./TestFx.slnx", "/restore", @@ -257,6 +256,8 @@ stages: displayName: Preserve cache diagnostics and clean failed seed outputs condition: and(always(), ne(variables['MSBuildCacheBuildSucceeded'], 'true')) + # Keep the cache support packages out of the multithreaded fallback. Their unannotated + # ResolveFileAccesses task currently fails in MSBuild's sidecar task host under -mt. - script: eng\common\CIBuild.cmd -configuration $(_BuildConfig) -msbuildMultiThreaded 1 @@ -264,7 +265,7 @@ stages: /p:Publish=false /p:Test=false /p:FastAcceptanceTest=true - /p:MSBuildCachePackageEnabled=true + /p:MSBuildCachePackageEnabled=false /p:MSBuildCacheEnabled=false name: Build displayName: Build @@ -278,7 +279,6 @@ stages: -ci ` -disablePipelineSetResult ` -configuration $(_BuildConfig) ` - -msbuildMultiThreaded $true ` -binaryLogName "$(Build.SourcesDirectory)\artifacts\log\$(_BuildConfig)\SignPack.binlog" ` -restore ` -sign ` @@ -457,7 +457,6 @@ stages: "-NoProfile", "-File", "./eng/common/msbuild.ps1", "-prepareMachine", - "-msbuildMultiThreaded:`$true", "-warnAsError:`$false", "./TestFx.slnx", "/restore", @@ -601,7 +600,6 @@ stages: "-ci", "-disablePipelineSetResult", "-configuration", "$(_BuildConfig)", - "-msbuildMultiThreaded:`$true", "-binaryLogName", "$(Build.SourcesDirectory)\artifacts\log\$(_BuildConfig)\SignPack.binlog", "-restore", "-sign", @@ -710,6 +708,8 @@ stages: # Fallback build. Skipped when the MSBuildCache steps above already produced, signed and packed the # outputs; also skipped when they failed with build errors, because this step would only reproduce them. + # Keep the cache support packages out of this multithreaded build because their unannotated + # ResolveFileAccesses task currently fails in MSBuild's sidecar task host under -mt. - script: eng\common\CIBuild.cmd -configuration $(_BuildConfig) -msbuildMultiThreaded 1 @@ -717,7 +717,7 @@ stages: /p:Publish=false /p:Test=false /p:FastAcceptanceTest=true - /p:MSBuildCachePackageEnabled=true + /p:MSBuildCachePackageEnabled=false /p:MSBuildCacheEnabled=false name: Build displayName: Build