Skip to content

Replace MSBUILD_NODEREUSE_ENABLED env var with a switch (allow node reuse on CI) #17013

Done

Description

@JanProvaznik

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: dotnet/dotnet#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).

Activity

  1. ViktorHofer commented on Jun 30, 2026

    @ViktorHofer
    Member

    The standard eng/common build script are already msbuild focused. Any additional passed in argument gets automatically appended to the msbuild process invocation:

    @properties

    Therefore, I don't think that we even need new parameters for these kind of features. Whenever we introduce a new msbuild parameter I would do the following:

    • Pass the new switch to the build.ps1 / build.sh invocation in the repos (i.e. from the VMR)
    • Repos that have custom build.ps1 / build.sh scripts and don't auto-forward parameters to msbuild, either define a parameter for that new feature or even better introduce something like a msbuildParameters switch once so that we don't have to repeat this again and again. IIRC repos affected that are part of the VMR are aspnetcore, fsharp, roslyn and nuget.

    So concretely, I would remove the MSBUILD_NODEREUSE_ENABLED and MSBUILD_MT_ENABLED env vars and replace them with build script invocation parameters.

  2. added a commit that references this issue on Sep 3, 2026
  3. ViktorHofer commented on Dec 1, 2026

    @ViktorHofer
    Member

    Closing. I did this a while ago.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions