Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 27, 2026

Context

End-to-end validation is needed for MSBuild's experimental -mt (multithreaded) mode. Currently no CI check verifies that MSBuild can build itself using this mode.

Changes Made

Added new CI job BootstrapMSBuildWithMTMode in .vsts-dotnet-ci.yml:

  • 2-stage bootstrap build with /mt flag passed only to Stage 2 (bootstrapped MSBuild)
  • Runs on Linux (ubuntu-latest) for faster/cheaper builds
  • Publishes build logs as artifacts for debugging
  • Tests are skipped - the job only performs the 2-stage build

Added new parameters to cibuild_bootstrapped_msbuild.sh:

  • --stage2Properties: Allows passing MSBuild properties only to Stage 2 (the bootstrapped build)
  • --skipTests: Switch to skip running tests in Stage 2
. 'eng/cibuild_bootstrapped_msbuild.sh' --onlyDocChanged $(onlyDocChanged) --skipTests --stage2Properties '/mt'

Testing

YAML syntax validated. The job itself validates the feature by building MSBuild with -mt mode on each PR.

Notes

The /mt flag is passed via the new --stage2Properties parameter which is only splatted to Stage 2 builds. This is necessary because the /mt switch is not compatible with the SDK MSBuild used in Stage 1.

The --skipTests switch ensures the CI job only performs the 2-stage build and uploads logs, without running the full test suite.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add a CI job that does a 2 stage build of msbuild, the second stage with bootstrapped -mt mode</issue_title>
<issue_description>### Summary

add validating msbuild can build itself with -mt mode

Background and Motivation

The purpose is an an end to end test for validating -mt mode migrations

Proposed Feature

.vsts-dotnet-ci.yml defines required PR checks
Add one that first builds msbuild with build.cmd, and then builds another copy with -mt mode, it should have the similar config to Windows core job

Ideally it would be extensible to be able to include another repository to build with -mt mode

Alternative Designs

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@dotnet-policy-service
Copy link
Contributor

Hello @@copilot, I noticed that you’re changing an .swr file or any file under src/Package/MSBuild.VSSetup.. Please make sure to validate this change by an experimental VS insertion. This is accomplished by pushing to an exp/* branch, which requires write permissions to this repo.

Copilot AI changed the title [WIP] Add CI job for two-stage msbuild with -mt mode Add CI job for 2-stage build with -mt multithreaded mode Jan 27, 2026
Copilot AI requested a review from JanProvaznik January 27, 2026 09:30
@JanProvaznik
Copy link
Member

the job is failing @copilot

Check failure on line 72 in .dotnet\sdk\10.0.101\Microsoft.Common.CrossTargeting.targets

@azure-pipelines
azure-pipelines
/ msbuild-pr (Windows Core Multithreaded Mode)
.dotnet\sdk\10.0.101\Microsoft.Common.CrossTargeting.targets#L72

.dotnet\sdk\10.0.101\Microsoft.Common.CrossTargeting.targets(72,5): error MSB3202: The project file "Microsoft.Build.Framework.csproj" was not found.
Check failure on line 72 in .dotnet\sdk\10.0.101\Microsoft.Common.CrossTargeting.targets

@azure-pipelines
azure-pipelines
/ msbuild-pr (Windows Core Multithreaded Mode)
.dotnet\sdk\10.0.101\Microsoft.Common.CrossTargeting.targets#L72

.dotnet\sdk\10.0.101\Microsoft.Common.CrossTargeting.targets(72,5): error MSB3202: The project file "Microsoft.Build.Framework.csproj" was not found.
Check failure on line 72 in .dotnet\sdk\10.0.101\Microsoft.Common.CrossTargeting.targets

@azure-pipelines
azure-pipelines
/ msbuild-pr (Windows Core Multithreaded Mode)
.dotnet\sdk\10.0.101\Microsoft.Common.CrossTargeting.targets#L72

.dotnet\sdk\10.0.101\Microsoft.Common.CrossTargeting.targets(72,5): error MSB3202: The project file "Microsoft.Build.Framework.csproj" was not found.
Check failure on line 1844 in .dotnet\sdk\10.0.101\Microsoft.Common.CurrentVersion.targets

@azure-pipelines
azure-pipelines
/ msbuild-pr (Windows Core Multithreaded Mode)
.dotnet\sdk\10.0.101\Microsoft.Common.CurrentVersion.targets#L1844

.dotnet\sdk\10.0.101\Microsoft.Common.CurrentVersion.targets(1844,5): error MSB3202: (NETCORE_ENGINEERING_TELEMETRY=Build) The project file "..\Framework\Microsoft.Build.Framework.csproj" was not found.
Check failure on line 1844 in .dotnet\sdk\10.0.101\Microsoft.Common.CurrentVersion.targets

@azure-pipelines
azure-pipelines
/ msbuild-pr (Windows Core Multithreaded Mode)
.dotnet\sdk\10.0.101\Microsoft.Common.CurrentVersion.targets#L1844

.dotnet\sdk\10.0.101\Microsoft.Common.CurrentVersion.targets(1844,5): error MSB3202: (NETCORE_ENGINEERING_TELEMETRY=Build) The project file "..\Utilities\Microsoft.Build.Utilities.csproj" was not found.

Copy link
Contributor Author

Copilot AI commented Jan 27, 2026

the job is failing @copilot

Check failure on line 72 in .dotnet\sdk\10.0.101\Microsoft.Common.CrossTargeting.targets
...

Fixed in a0f9761. The issue was that /mt was being passed to both Stage 1 and Stage 2, but /mt doesn't work with the SDK MSBuild used in Stage 1.

Added a new stage2Properties parameter to cibuild_bootstrapped_msbuild.ps1 that passes properties only to the Stage 2 bootstrapped build. Now Stage 1 runs normally and Stage 2 runs with /mt.

@JanProvaznik
Copy link
Member

@copilot I don't want this new CI job to run tests, only do the 2 stage build and upload logs from building

Copy link
Contributor Author

Copilot AI commented Jan 27, 2026

@copilot I don't want this new CI job to run tests, only do the 2 stage build and upload logs from building

Fixed in 567faf6. Added a new -skipTests switch parameter to cibuild_bootstrapped_msbuild.ps1 and updated the CI job to use it. The job now only performs the 2-stage build and uploads logs without running tests.

@JanProvaznik JanProvaznik marked this pull request as ready for review January 27, 2026 11:22
@JanProvaznik JanProvaznik requested a review from a team as a code owner January 27, 2026 11:22
Copilot AI review requested due to automatic review settings January 27, 2026 11:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds CI validation for MSBuild's experimental -mt (multithreaded) mode by introducing a new Windows CI job that performs a 2-stage bootstrap build with the /mt flag applied only to the second stage.

Changes:

  • Added new CI job BootstrapMSBuildWithMTMode that builds MSBuild using the dotnet engine with /mt flag in Stage 2
  • Extended cibuild_bootstrapped_msbuild.ps1 with skipTests switch and stage2Properties parameter to support custom Stage 2-only MSBuild properties
  • Stage 1 intentionally excludes stage2Properties since /mt is incompatible with the SDK MSBuild used in Stage 1

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.vsts-dotnet-ci.yml Adds new CI job BootstrapMSBuildWithMTMode on Windows 2022 that performs 2-stage build with /mt flag, publishes build logs, and skips tests
eng/cibuild_bootstrapped_msbuild.ps1 Adds skipTests switch and stage2Properties string array parameter; applies stage2Properties only to Stage 2 builds with clear comments explaining the exclusion from Stage 1

- job: BootstrapMSBuildWithMTMode
displayName: "Windows Core Multithreaded Mode"
pool:
vmImage: 'windows-2022'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we care about Windows specifically? If not it might be cheaper or faster to use a Linux queue for this.

@JanProvaznik
Copy link
Member

@copilot make the job run on linux instead

Copy link
Contributor Author

Copilot AI commented Jan 29, 2026

@copilot make the job run on linux instead

Done in d2e4f7e. Changed the CI job to run on Linux (ubuntu-latest) instead of Windows. Also added --skipTests and --stage2Properties support to cibuild_bootstrapped_msbuild.sh to match the PowerShell script functionality.

[bool] $buildStage1 = $True,
[bool] $onlyDocChanged = 0,
[switch] $skipTests,
[string[]] $stage2Properties = @(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert @copilot yagni

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted in e0f78f1. The PowerShell script is back to its original state since the job now runs on Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a CI job that does a 2 stage build of msbuild, the second stage with bootstrapped -mt mode

3 participants