Repository navigation
Refactor bootstrapped build infrastructure - #14361
Merged
Merged
Conversation
ViktorHofer
force-pushed
the
InfraRefactoring
branch
from
July 14, 2026 20:40
7d7831d to
d6b0253
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors MSBuild’s bootstrapped (multi-stage) build infrastructure by moving stage orchestration into eng/build.ps1 and a new eng/build.sh, removing older helper scripts, and updating Azure Pipelines and entrypoints (build.cmd / build.sh) to use the new flow.
Changes:
- Introduces aligned stage1/stage2 wrapper scripts (
eng/build.ps1and neweng/build.sh) and removes the legacyeng/cibuild_bootstrapped_msbuild.*helpers. - Updates pipeline YAML and repo entrypoints to route CI through the new wrappers.
- Replaces the old “produces no output” import mechanism in some projects with
ExcludeFromBuild, and moves the EngineServices version-bump enforcement intoMicrosoft.Build.Framework.csproj.
Show a summary per file
| File | Description |
|---|---|
| src/UnitTests.Shared/RunnerUtilities.cs | Removes outdated comment reference to deleted bootstrap scripts. |
| src/Tasks/Copy.cs | Trims outdated local-build instructions in comments. |
| src/Package/MSBuild.VSSetup/MSBuild.VSSetup.csproj | Switches skip mechanism from ShouldSkipProject/import to ExcludeFromBuild. |
| src/Package/MSBuild.VSSetup.Arm64/MSBuild.VSSetup.Arm64.csproj | Same skip-mechanism refactor for Arm64 VSSetup. |
| src/Package/DevDivPackage/DevDivPackage.csproj | Adjusts build exclusion behavior for non-Full runtime builds. |
| src/MSBuildTaskHost/MSBuildTaskHost.csproj | Changes how net35 TaskHost is excluded on non-Full runtime builds. |
| src/Framework/Microsoft.Build.Framework.csproj | Moves TLB packing target and adds CI PR-time EngineServices version-bump check. |
| src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj | Tightens MSBuildTaskHost reference condition to Full runtime builds. |
| eng/ProducesNoOutput.Settings.props | Deleted (previously used to no-op excluded projects). |
| eng/ProducesNoOutput.Imports.props | Deleted (previously used to no-op excluded projects). |
| eng/generate-optprof-run-settings.ps1 | Deleted helper script. |
| eng/configure-toolset.sh | Deleted helper script. |
| eng/configure-toolset.ps1 | Deleted helper script. |
| eng/CIBuild.cmd | Deleted legacy CI entrypoint. |
| eng/cibuild_bootstrapped_msbuild.sh | Deleted legacy two-stage bash helper. |
| eng/cibuild_bootstrapped_msbuild.ps1 | Deleted legacy two-stage PowerShell helper. |
| eng/cibuild_bootstrapped_msbuild.cmd | Deleted legacy cmd shim for the PowerShell helper. |
| eng/build.sh | New bash wrapper that implements stage1/stage2 orchestration. |
| eng/build.ps1 | Refactored PowerShell wrapper implementing stage1/stage2 orchestration. |
| documentation/wiki/Building-Testing-and-Debugging-on-Full-Framework-MSBuild.md | Updates instructions for mimicking CI locally. |
| build.sh | Updates repo-root entrypoint to call eng/build.sh. |
| build.cmd | Updates repo-root entrypoint to call eng/build.ps1. |
| azure-pipelines/quarantine.yml | Updates quarantined test runs to use new build entrypoints. |
| azure-pipelines/cts-steps/collect-steps.yml | Updates CTS collect step to use repo entrypoints. |
| azure-pipelines/cts-steps/apply-steps.yml | Updates CTS apply step to use repo entrypoints. |
| azure-pipelines/.vsts-dotnet-exp-perf.yml | Removes stale comments. |
| azure-pipelines/.vsts-dotnet-build-jobs.yml | Updates official build step invocation and related variables. |
| .vsts-dotnet.yml | Adjusts variables for optimization-data handling. |
| .vsts-dotnet-ci.yml | Updates CI build steps to use new wrappers/args. |
| .github/workflows/copilot-setup-steps.yml | Updates restore step to use repo-root build.sh. |
Copilot's findings
- Files reviewed: 30/30 changed files
- Comments generated: 9
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Emit no context lines in the EngineServices diff so the 'int Version =' check only matches genuinely changed lines, not unchanged context. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f1a70d70-f0e7-4cc9-b2e5-527e980bcb78
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: cda0bfa1-ae78-403f-8a53-cb4ec762ed0d
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: cda0bfa1-ae78-403f-8a53-cb4ec762ed0d
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: cda0bfa1-ae78-403f-8a53-cb4ec762ed0d
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: cda0bfa1-ae78-403f-8a53-cb4ec762ed0d
Member
This isn't true but should be ok because of dotnet/arcade#17122 |
ViktorHofer
enabled auto-merge (squash)
July 15, 2026 21:08
AlesProkop
approved these changes
Jul 16, 2026
ViktorHofer
pushed a commit
that referenced
this pull request
Jul 28, 2026
I use a particular set of flags to build .NET VMR, which flows something
like this to the msbuild build scripts:
$ ./build.sh /p:OfficialBuilder="Red Hat Inc."
This regressed recently (probably
#14361). This change fixes the
issue.
For arrays which can be empty, use the ${var[@]+"${var[@]}"} syntax, as
discussed in dotnet/dotnet#797, to avoid issues
on macOS.
Assisted-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
AR-May
added a commit
that referenced
this pull request
Aug 3, 2026
…14591) PR #14361 changed the top-level build scripts to invoke the repository-specific `eng/build.ps1` and `eng/build.sh` wrappers instead of calling the Arcade build scripts directly. Before that refactoring, `-c` and `-t` were supported by `eng/common/build.ps1` and `eng/common/build.sh` . The new wrappers retained the configuration and test parameters, but did not retain their short aliases. On Windows, this caused `build.cmd -c Release` to fail because PowerShell interpreted `-c` as ambiguous between `-configuration` and `-ci`.
corngood
reviewed
Aug 14, 2026
| @@ -0,0 +1,135 @@ | |||
| #! /bin/bash | |||
There was a problem hiding this comment.
This isn't portable. It's causing problems for me on NixOS. It should probably use the same shebang as the other scripts and assume bash is in $PATH.
corngood
reviewed
Aug 14, 2026
| echo "Stage 1 build: /bin/bash \"$build_script\" $build_args" | ||
| fi | ||
|
|
||
| /bin/bash "$build_script" $build_args |
There was a problem hiding this comment.
This and the other references to /bin/bash are also a problem.
ViktorHofer
added a commit
that referenced
this pull request
Aug 14, 2026
Follow-up to #14361 addressing @corngood's review feedback: `eng/build.sh` isn't portable and breaks on NixOS. - Shebang `#! /bin/bash` -> `#!/usr/bin/env bash`, matching every other script in this repo (including `build.sh` and `eng/common/*.sh`). - The hardcoded `/bin/bash` invocations of the stage 1 / stage 2 builds now use `bash` from `\`. The echoed command lines were updated to match. No behavioral change on distributions where bash lives at `/bin/bash`. Copilot-Session: fcd4cd36-f7ca-48cf-9c4d-7f9601ef3db2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Refactors the bootstrapped build infrastructure, consolidating the multi-stage build logic into the
eng/build.ps1/eng/build.shwrapper scripts and removing now-redundant helper scripts.Highlights
eng/build.ps1around an explicit-stage2switch: single-stage by default, with the two-stage bootstrap flow running only when-stage2is requested (or-stage2Argumentsare supplied).eng/build.shas the aligned bash counterpart, mirroring the PowerShell logic (staging behavior,--testopt-in,stage2Argumentshandling, bootstrap tool/env-var handoff). There is only one MSBuild engine (dotnet) on non-Windows, so no engine selection is performed there.eng/cibuild_bootstrapped_msbuild.{cmd,ps1,sh}helpers and other obsolete infra files, folding their responsibilities into the wrapper scripts and pipeline YAML.build.cmd/build.shentry points accordingly.Notes
eng/common/**(Arcade-owned) is intentionally left untouched; only MSBuild-specific wrapper scripts are modified.Draft for CI validation and review.