Use channel mappings for integration restore#17636
Conversation
Project-reference integration restores now use the explicit channel's temporary NuGet.config when available so staging/DARC package source mappings are honored even without --source. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17636Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17636" |
There was a problem hiding this comment.
Pull request overview
Fixes integration restore for polyglot (e.g., TypeScript) AppHosts using the prebuilt/bundled AppHost server when an ambient NuGet.config has packageSourceMapping that would otherwise exclude the staging/DARC feed. The project-reference restore path now prefers generating and using a temporary NuGet.config so resolved channel mappings (e.g., Aspire* -> staging/DARC) are honored even when --source is not provided.
Changes:
- Always attempt to create and use a temporary
NuGet.configfor explicit-channel project-reference restore so channel package source mappings are applied. - Update/replace the regression test to assert the generated restore project uses
<RestoreConfigFile>and that the temp config contains expectedpackageSourceMappingentries.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Aspire.Cli/Projects/PrebuiltAppHostServer.cs | Switches project-reference restore to use a temporary NuGet.config for explicit channels to preserve channel package source mappings. |
| tests/Aspire.Cli.Tests/Projects/PrebuiltAppHostServerTests.cs | Updates regression coverage to validate <RestoreConfigFile> is used and channel mappings are present in the generated temp NuGet.config. |
| // Explicit channels need their package source mappings during project-reference restore. | ||
| // RestoreAdditionalProjectSources can add the feed URLs, but it cannot override ambient | ||
| // packageSourceMapping entries that might route Aspire* packages to another feed. | ||
| using var temporaryNuGetConfig = await TryCreateTemporaryNuGetConfigAsync(requestedChannel, packageSourceOverride, cancellationToken); |
|
❓ CLI E2E Tests unknown — 107 passed, 0 failed, 2 unknown (commit View all recordings
📹 Recordings uploaded automatically from CI run #26608132894 |
Description
TypeScript and other polyglot AppHosts that use the bundled AppHost server can fail to restore Aspire integrations from staging CLI builds when an ambient
NuGet.confighas package source mappings. In that case, adding the staging/DARC feed asRestoreAdditionalProjectSourcesis not enough because NuGet still applies the ambient mapping and can routeAspire*packages away from the staging feed.This changes the project-reference integration restore path to reuse the existing temporary NuGet.config flow for explicit channels, even when
--sourceis not provided. That preserves channel mappings such asAspire* -> DARC feedwhile keeping--sourceoverride behavior on the stronger override path and preserving the local hive guardrails.There is no new command syntax. Existing staging-channel TypeScript/polyglot AppHosts should now restore integration packages through the channel mappings that the CLI resolved for the staging build.
Fixes #17629
Validation:
./restore.shdotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-method "*.PrebuiltAppHostServerTests.PrepareAsync_WithProjectReferencesAndExplicitChannelButNoOverride_UsesNuGetConfigForChannelMappings" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.PrebuiltAppHostServerTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"git diff --checkChecklist
<remarks />and<code />elements on your triple slash comments?