SetupNugetSources: skip configure-toolset import#16984
Merged
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
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 = $truebefore dot-sourcingtools.ps1. - Set
disable_configure_toolset_import=1before sourcingtools.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
akoeplinger
approved these changes
Jun 8, 2026
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
SetupNugetSources.ps1/SetupNugetSources.shonly need helper functions fromtools.ps1/tools.shto configure NuGet feeds. However, dot-sourcingtoolsalso imports the repo'sconfigure-toolsetscript 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) callsInstallBootstrapSdkWithDotnetupat its top level. That guard skips whenfromVMRis true orrestoreis not requested:When
SetupNugetSources.ps1dot-sourcestools.ps1outside a build (e.g. the VMR "Setup Internal Feeds" pipeline step, which runsSetupNugetSources.ps1for everysrc/<repo>), the guard inputs fall back totools.ps1defaults:restore=$true(tools.ps1:20) andfromVMR=$false(tools.ps1:66). The guard therefore evaluates false and dotnetup runs, acquiring a bootstrap SDK intosrc/sdk/.dotnetand polluting the source tree.This is the root cause of dotnet/dotnet#7112 (all
mainVMR official builds broken since June 5): the bootstrap SDK dropped intosrc/sdk/.dotnetthen drives the downstreamredist/GenerateSdkRuntimeIdentifierChainMSB4216 task-host failure and shows up in source-build binary detection.Fix
Set
disableConfigureToolsetImport/disable_configure_toolset_importbefore sourcingtools, 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--fromVMRskip).Note / possible follow-up
A few other pure-utility scripts also dot-source
toolswithout 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 toSetupNugetSources; adding the flag to those is a reasonable follow-up.Refs dotnet/dotnet#7112