Skip to content

SetupNugetSources: skip configure-toolset import#16984

Merged
ViktorHofer merged 1 commit into
mainfrom
setupnugetsources-skip-configure-toolset
Jun 8, 2026
Merged

SetupNugetSources: skip configure-toolset import#16984
ViktorHofer merged 1 commit into
mainfrom
setupnugetsources-skip-configure-toolset

Conversation

@ViktorHofer

Copy link
Copy Markdown
Member

Summary

SetupNugetSources.ps1 / SetupNugetSources.sh only need helper functions from tools.ps1 / tools.sh to configure NuGet feeds. However, dot-sourcing tools also imports the repo's configure-toolset script as a side effect (tools.ps1:948, tools.sh:653).

In the SDK repo, eng/configure-toolset.{ps1,sh} now (after dotnet/sdk introducing the dotnetup bootstrap mechanism) calls InstallBootstrapSdkWithDotnetup at its top level. That guard skips when fromVMR is true or restore is not requested:

if ((-not $restore) -or $fromVmr -or [string]::IsNullOrEmpty($dotnetSdkVersion)) { return }

When SetupNugetSources.ps1 dot-sources tools.ps1 outside a build (e.g. the VMR "Setup Internal Feeds" pipeline step, which runs SetupNugetSources.ps1 for every src/<repo>), the guard inputs fall back to tools.ps1 defaults: restore=$true (tools.ps1:20) and fromVMR=$false (tools.ps1:66). The guard therefore evaluates false and dotnetup runs, acquiring a bootstrap SDK into src/sdk/.dotnet and polluting the source tree.

This is the root cause of dotnet/dotnet#7112 (all main VMR official builds broken since June 5): the bootstrap SDK dropped into src/sdk/.dotnet then drives the downstream redist / GenerateSdkRuntimeIdentifierChain MSB4216 task-host failure and shows up in source-build binary detection.

Fix

Set disableConfigureToolsetImport / disable_configure_toolset_import before sourcing tools, so feed configuration no longer triggers repo-specific toolset acquisition. This matches the existing pattern already used by the post-build utility scripts (check-channel-consistency.ps1, nuget-validation.ps1, publish-using-darc.ps1, redact-logs.ps1).

Genuine builds (build.ps1/build.sh -restore) are unaffected and still acquire the bootstrap SDK as intended (including the VMR's --fromVMR skip).

Note / possible follow-up

A few other pure-utility scripts also dot-source tools without the opt-out (darc-init, internal-feed-operations, vmr-sync, post-build/symbols-validation). They aren't exercised in the failing pipeline path, so this PR keeps the change scoped to SetupNugetSources; adding the flag to those is a reasonable follow-up.

Refs dotnet/dotnet#7112

SetupNugetSources only needs tools helper functions to configure NuGet feeds, but dot-sourcing tools.ps1/tools.sh also imports the repo's configure-toolset script as a side effect. In the SDK repo this now runs InstallBootstrapSdkWithDotnetup, which acquires a bootstrap SDK via dotnetup whenever feeds are set up (e.g. the VMR 'Setup Internal Feeds' pipeline step) because fromVMR is not set and restore defaults to true in that bare context.

Set disableConfigureToolsetImport / disable_configure_toolset_import before sourcing tools, matching the existing post-build utility scripts, so feed configuration no longer triggers toolset acquisition.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates SetupNugetSources.ps1 / SetupNugetSources.sh to avoid importing eng/configure-toolset.{ps1,sh} as a side effect of dot-sourcing tools.{ps1,sh}. This keeps feed-configuration runs (e.g., VMR “Setup Internal Feeds” utility usage) from triggering repo-specific toolset/bootstrap SDK acquisition and polluting the source tree.

Changes:

  • Set $disableConfigureToolsetImport = $true before dot-sourcing tools.ps1.
  • Set disable_configure_toolset_import=1 before sourcing tools.sh.
Show a summary per file
File Description
eng/common/SetupNugetSources.sh Sets disable_configure_toolset_import before sourcing tools.sh to skip configure-toolset.sh side effects during feed setup.
eng/common/SetupNugetSources.ps1 Sets $disableConfigureToolsetImport before dot-sourcing tools.ps1 to skip configure-toolset.ps1 side effects during feed setup.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

@ViktorHofer ViktorHofer requested review from akoeplinger and lewing June 8, 2026 08:54
@ViktorHofer ViktorHofer enabled auto-merge (squash) June 8, 2026 09:55
@ViktorHofer ViktorHofer merged commit c282d71 into main Jun 8, 2026
11 checks passed
@ViktorHofer ViktorHofer deleted the setupnugetsources-skip-configure-toolset branch June 8, 2026 13:02
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview6 milestone Jun 8, 2026
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.

3 participants