Replace MSBUILD_NODEREUSE_ENABLED env var with a switch (allow node reuse on CI)
- Dominant language
- C#
- Stars
- 729
- Forks
- 397
- Avg merge
- 3d 15m
- Merged PRs (30d)
- 149
Description
### Background
The VMR (dotnet/dotnet) added an **opt-in** to allow MSBuild node reuse on CI (which is otherwise forced off). It is implemented as an environment variable, `MSBUILD_NODEREUSE_ENABLED`, mirroring the existing `MSBUILD_MT_ENABLED` (`-mt`) pattern:
- `repo-projects/Directory.Build.props` sets `MSBUILD_NODEREUSE_ENABLED=1` when `/p:DotNetBuildNodeReuse=true` is passed.
- The Arcade `eng/common` `build` / `msbuild` / `tools` scripts only force `nodeReuse=false` on CI when `MSBUILD_NODEREUSE_ENABLED != 1`, and gate the *"Node reuse must be disabled in CI build"* guard the same way.
See VMR PR: https://github.com/dotnet/dotnet/pull/7211
### Problem
Per Arcade convention, the controls in `eng/common/tools.ps1` / `tools.sh` (and `build.*` / `msbuild.*`) are **switch-based** parameters, not environment variables. `nodeReuse` itself is already a switch (`-nodeReuse` / `--nodeReuse`). Using a magic env var to override it is inconsistent and less discoverable. The Arcade team owns these entry points.
### Ask
Replace the `MSBUILD_NODEREUSE_ENABLED` env-var check in the Arcade `eng/common` scripts with a proper switch (e.g. `-allowNodeReuseOnCI` / `--allow-node-reuse-on-ci`) that:
- prevents the CI override that forces `nodeReuse=false`, and
- suppresses the `"Node reuse must be disabled in CI build"` guard in `MSBuild-Core`,
allowing the existing `-nodeReuse` switch to take effect on CI. The VMR would then pass that switch (from `Directory.Build.props`) instead of setting the env var.
### Notes
- The current env-var approach is intentionally marked *"internal testing only"* in the VMR and is not meant to be a permanent blessed mechanism.
- Worth deciding whether a permanent, supported way to bypass the no-node-reuse-on-CI guard is desirable at all (that guard exists for determinism / stale tasks / locked-file reasons).
Contributor guide
Research direction
Start by tracing the existing checks in eng/common/tools.ps1, tools.sh, build.*, msbuild.*, and the MSBuild-Core guard. Compare them with repo-projects/Directory.Build.props and the VMR PR to understand how the current environment variable flows. Done means a documented switch replaces that flow, lets -nodeReuse apply on CI, and suppresses the guard when explicitly enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell, shell
- Domain
- build-system, ci-cd, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100