Skip to content

Use repository NuGet configuration for SDK dump restores - #20062

Open
James Newton-King (JamesNK) wants to merge 2 commits into
mainfrom
fix-sdk-dump-nuget-config
Open

Use repository NuGet configuration for SDK dump restores#20062
James Newton-King (JamesNK) wants to merge 2 commits into
mainfrom
fix-sdk-dump-nuget-config

Conversation

@JamesNK

@JamesNK James Newton-King (JamesNK) commented Sep 11, 2026

Copy link
Copy Markdown
Member

Description

Running aspire sdk dump against the local Aspire checkout can fail before scanning capabilities because the scanner's temporary app directory is outside the repository's NuGet configuration hierarchy. The failures linked from #20029 report NU1100 errors resolving Dashboard's Fluent UI packages, not warnings in the exported capabilities.

In repository-development mode, SDK dump now starts NuGet configuration discovery from the repository root. Configuration files remain in their original locations, preserving package-source names and mappings, relative feed paths, and settings inherited from parent directories.

  • Both --output and --output-directory pass the detected repository root through the AppHost server project factory.
  • The generated scanner project sets RestoreRootConfigDirectory and skips copying the app's NuGet configuration when this override is supplied. Other callers retain their existing configuration behavior.
  • The real SDK dump integration test now includes the command, project path, expected and actual exit codes, stdout, and stderr in failure diagnostics. Captured streams are also forwarded to test output if the command throws or times out.

Fixes #20029

Example

The existing checkout-development command uses the repository's NuGet configuration automatically, without new command-line options:

aspire sdk dump --format ci --output capabilities.txt ./src/Aspire.Hosting/Aspire.Hosting.csproj

Validation

  • Added coverage for both output modes to verify the scanner's restore configuration root, absence of copied files in its temporary directory, and temporary-directory cleanup. The test deliberately stops preparation before a real build or RPC session.
  • Added a regression that evaluates NuGet's actual _GetRestoreSettings target without restoring packages. It verifies that relative feeds resolve beside the original repository and parent configuration files, inherited settings remain available, and a conflicting app-local configuration is not used.
  • All 101 tests across SdkDumpCommandTests, AppHostServerProjectTests, and GuestAppHostProjectTests passed locally on Windows, with quarantined and outerloop tests excluded.
  • Verified the integration test's failure diagnostics using a temporary missing-project probe, then removed the probe and reran SdkDumpCi_ForHostingProject_DoesNotEmitWarnings successfully.
  • git diff --check passed.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 20062

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 20062"

@github-actions

This comment has been minimized.

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.

🟢 Approval recommended

The focused fix is consistent across both scanner paths and has appropriate regression coverage.

Pull request overview

Fixes #20029 by making SDK capability scanning inherit the repository’s NuGet sources and package mappings.

Changes:

  • Copies the repository NuGet configuration into temporary scanner projects.
  • Adds regression coverage for both output modes and cleanup.
File summaries
File Description
src/Aspire.Cli/Commands/Sdk/SdkDumpCommand.cs Prepares temporary scanner projects with repository NuGet configuration.
tests/Aspire.Cli.Tests/Commands/SdkDumpCommandTests.cs Verifies configuration copying and temporary-directory cleanup.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot September 11, 2026 07:11
@JamesNK James Newton-King (JamesNK) changed the title Fix SDK dump repository NuGet configuration Use repository NuGet configuration for SDK dump restores Sep 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

2 / 99 PR test projects · 4 PR jobs · 1 advisory-only target, from 7 changed files.

Selected PR test projects (2 / 99)

Aspire.Cli.EndToEnd.Tests, Aspire.Cli.Tests

Selected PR jobs (4)

cli-starter-validation, extension-e2e, polyglot, typescript-api-compat

Advisory workflow impact (1)

  • deployment-e2e (schedule/dispatch-only)

How these were chosen — grouped by what changed

📦 affected project Aspire.Cli
1 test: Aspire.Cli.EndToEnd.Tests

🧪 tests/Aspire.Cli.Tests/Commands/SdkDumpCommandTests.cs (changed test)
1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Projects/AppHostServerProjectTests.cs (changed test)
1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Projects/GuestAppHostProjectTests.cs (changed test)
1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/TestServices/TestAppHostServerProjectFactory.cs (changed test)
1 directly: Aspire.Cli.Tests

Job reasons

Job Triggered by
cli-starter-validation affected project Aspire.Cli
deployment-e2e affected project Aspire.Cli
extension-e2e src/Aspire.Cli/Commands/Sdk/SdkDumpCommand.cs, src/Aspire.Cli/Projects/AppHostServerProject.cs, src/Aspire.Cli/Projects/DotNetBasedAppHostServerProject.cs, tests/Aspire.Cli.Tests/Commands/SdkDumpCommandTests.cs, tests/Aspire.Cli.Tests/Projects/AppHostServerProjectTests.cs, tests/Aspire.Cli.Tests/Projects/GuestAppHostProjectTests.cs, tests/Aspire.Cli.Tests/TestServices/TestAppHostServerProjectFactory.cs
• affected project Aspire.Cli
polyglot affected project Aspire.Cli
typescript-api-compat affected project Aspire.Cli

Selection computed for commit 8c70b24.

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.

🟢 Approval recommended

The implementation is narrowly scoped and includes focused coverage for configuration discovery, relative feeds, inherited settings, and cleanup.

Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

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

Labels

Projects

None yet

2 participants