Skip to content

Honor configured channels when updating C# AppHosts - #22182

Merged
Karol Zadora-Przylecki (karolz-ms) merged 3 commits into
mainfrom
danegsta-update-honors-config-channel
Nov 12, 2026
Merged

Karol Zadora-Przylecki (karolz-ms) merged 3 commits into
mainfrom
danegsta-update-honors-config-channel

Conversation

@danegsta

Copy link
Copy Markdown
Member

Description

C# aspire update currently ignores the Aspire channel setting unless a channel is passed on the command line. This can leave nuget.config out of sync with the intended channel.

Honor the configured channel using the same NuGet policy comparison, preview, approval, validation, and rejection rules as --channel. Explicit --channel and legacy --quality options still take precedence. Configuration lookup follows the existing guest AppHost behavior: nearest project or legacy settings, then global fallback. C# updates without either a command-line or configured channel continue preserving native NuGet policy.

All AppHosts report when a non-stable channel comes from configuration. Configured stable applies the normal stable-channel cleanup without that notification. Unknown or unavailable configured channels fail with configuration-specific context rather than silently falling back.

User-facing usage

With this setting in aspire.config.json:

{
  "channel": "daily"
}
aspire update

The update now behaves like aspire update --channel daily and reports:

Using channel 'daily' from Aspire configuration. Pass --channel to override.

The existing command-line override remains available:

aspire update --channel stable

Relevant command help:

Usage:
  Aspire.Cli update [options]

Options:
  --channel <channel>  Channel to update to (stable, daily)

Validation

Passed: 400 tests, with one case-sensitive-filesystem test skipped on macOS:

.dotnet/dotnet artifacts/bin/Aspire.Cli.Tests/Debug/net11.0/Aspire.Cli.Tests.dll --filter-class '*.UpdateCommandTests' --filter-class '*.ProjectUpdaterTests' --filter-class '*.ProjectUpdaterNuGetConfigurationTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true' --timeout 5m

CLI localization resources were refreshed successfully with:

MSBUILDTERMINALLOGGER=false dotnet build src/Aspire.Cli/Aspire.Cli.csproj --no-restore /t:UpdateXlf --verbosity quiet

Fixes # (issue)

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

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@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 -- 22182

Or

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

@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.

🟡 Changes recommended

The configured-channel NuGet update workflow lacks end-to-end regression coverage for persisted feed policy, successful native restore, and unchanged files when the configuration preview is declined.

1 open issue
1 file not reviewed
  • src/Aspire.Cli/Resources/UpdateCommandStrings.Designer.cs: Generated file
What changed in this PR

This PR makes C# aspire update honor Aspire’s configured channel, using the existing NuGet policy update workflow while preserving command-line precedence.

Changes:

  • Resolves configured channels relative to the selected AppHost, with global fallback; preserves native NuGet policy when no channel is selected.
  • Adds configured-channel notifications and contextual errors, with refreshed localization resources.
  • Expands command tests and updates specifications for channel precedence and NuGet policy behavior.
File Description
tests/​Aspire.Cli.Tests/​Commands/​UpdateCommandTests.cs Tests configuration lookup, precedence, notifications, and errors.
src/​Aspire.Cli/​Resources/​xlf/​UpdateCommandStrings.zh-Hant.xlf Refreshes Traditional Chinese localization entries.
src/​Aspire.Cli/​Resources/​xlf/​UpdateCommandStrings.zh-Hans.xlf Refreshes Simplified Chinese localization entries.
src/​Aspire.Cli/​Resources/​xlf/​UpdateCommandStrings.tr.xlf Refreshes Turkish localization entries.
src/​Aspire.Cli/​Resources/​xlf/​UpdateCommandStrings.ru.xlf Refreshes Russian localization entries.
src/​Aspire.Cli/​Resources/​xlf/​UpdateCommandStrings.pt-BR.xlf Refreshes Brazilian Portuguese localization entries.
src/​Aspire.Cli/​Resources/​xlf/​UpdateCommandStrings.pl.xlf Refreshes Polish localization entries.
src/​Aspire.Cli/​Resources/​xlf/​UpdateCommandStrings.ko.xlf Refreshes Korean localization entries.
src/​Aspire.Cli/​Resources/​xlf/​UpdateCommandStrings.ja.xlf Refreshes Japanese localization entries.
src/​Aspire.Cli/​Resources/​xlf/​UpdateCommandStrings.it.xlf Refreshes Italian localization entries.
src/​Aspire.Cli/​Resources/​xlf/​UpdateCommandStrings.fr.xlf Refreshes French localization entries.
src/​Aspire.Cli/​Resources/​xlf/​UpdateCommandStrings.es.xlf Refreshes Spanish localization entries.
src/​Aspire.Cli/​Resources/​xlf/​UpdateCommandStrings.de.xlf Refreshes German localization entries.
src/​Aspire.Cli/​Resources/​xlf/​UpdateCommandStrings.cs.xlf Refreshes Czech localization entries.
src/​Aspire.Cli/​Resources/​UpdateCommandStrings.resx Adds configuration messages and revises restore-policy guidance.
src/​Aspire.Cli/​Resources/​UpdateCommandStrings.Designer.cs Adds resource accessors and synchronizes resource documentation.
src/​Aspire.Cli/​Projects/​IAppHostProject.cs Clarifies the HasExplicitChannel documentation.
src/​Aspire.Cli/​Commands/​UpdateCommand.cs Applies configured channels and reports their origin or resolution failure.
docs/​specs/​polyglot-integration-restore.md Documents configured-channel NuGet policy handling.
docs/​specs/​cli-identity-sidecar.md Clarifies channel selection versus CLI identity behavior.

Review effort: 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.

@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.

@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.

@danegsta

Copy link
Copy Markdown
Member Author

PR Testing Report

PR Information

  • PR: microsoft/aspire#22182
  • Title: Honor configured channels when updating C# AppHosts
  • Head commit: 90e84813fd027cbe802964d24e5e12de18416a4b
  • Tested at: 2026-11-12T00:38:10Z
  • Platform: macOS arm64, isolated temporary CLI installation and fresh generated AppHosts.

Artifact Version Verification

  • Expected commit: 90e84813fd027cbe802964d24e5e12de18416a4b
  • Installed CLI: 17.1.0-pr.22182.g90e84813
  • Status: Verified; the installed binary reports the PR head's short commit.
  • Artifact workflow: https://github.com/microsoft/aspire/actions/runs/43117987742
  • The live PR head was checked again after testing and remained unchanged.

The dogfood installer from the PR comment was used with --install-path, --skip-path, and --skip-extension. No shell profile or repository files were changed. The temporary NuGet hierarchy used an internal mirror for dependencies and the downloaded PR hive for PR packages. Machine-suggested Git configuration-source adoption was explicitly declined for the smoke fixtures.

Changes Analyzed

Files Changed

  • src/Aspire.Cli/Commands/UpdateCommand.cs: configured-channel resolution, notification, and propagation into the existing explicit-channel NuGet update path.
  • src/Aspire.Cli/Projects/IAppHostProject.cs: update-context documentation.
  • src/Aspire.Cli/Resources/UpdateCommandStrings.resx, its designer, and 13 XLIFF files: notification and diagnostics.
  • tests/Aspire.Cli.Tests/Commands/UpdateCommandTests.cs: selection, precedence, notification, and failure coverage.
  • docs/specs/cli-identity-sidecar.md and docs/specs/polyglot-integration-restore.md: updated behavior.

Change Categories

  • CLI behavior, tests, localization, and documentation
  • Hosting integration implementation
  • Dashboard
  • Project templates
  • Client/component integrations
  • VS Code extension
  • CI infrastructure

Test Scenarios Executed

Each channel scenario used a newly generated AppHost. Project-based fixtures were generated with aspire new and then converted from the generated file-based AppHost into a conventional SDK-based .csproj. The Linux E2E suite was not run locally; its existing CI results and recordings were inspected.

Command forms used, with paths abbreviated:

"$CLI" new aspire-empty --name ChannelTest --output "$APP_ROOT" \
  --language csharp --source "$PR_HIVE" --version 17.1.0-pr.22182.g90e84813 \
  --localhost-tld false --suppress-agent-init --use-config-source false --non-interactive

"$CLI" update --apphost "$APP_HOST" --yes --non-interactive

1. Fresh C# AppHost lifecycle

Coverage: Happy path. Status: Passed.

Created an empty C# AppHost from PR templates, started it with aspire start --isolated --non-interactive --format Json --apphost <path>, inspected it using aspire describe, and stopped that exact AppHost using aspire stop. All commands exited successfully. Describe returned the expected empty resource list; no running AppHosts remained afterward.

Evidence: smoke-create.log, smoke-start.log, smoke-describe.log, smoke-stop.log. The start-log dashboard login token was redacted in the preserved copy.

2. File-based C# configured-channel repair and idempotence

Coverage: Happy path and matching-policy boundary. Status: Passed.

Configured pr-22182, pointed the CLI-owned Aspire source at an empty old feed, and invoked update without --channel. The CLI reported the configured channel, displayed the feed/mapping changes, replaced the obsolete feed with the PR hive, and completed native restore. A second update reported the project up to date and preserved the NuGet configuration bytes exactly.

Evidence: repair-file-update.log, repair-file-repeat.log, repair-file-before.config, repair-file-after.config.

3. Project-based C# configured-channel repair and idempotence

Coverage: Happy path and matching-policy boundary. Status: Passed.

Repeated scenario 2 with an SDK-based .csproj. The CLI acquired the target AppHost SDK, validated native restore, persisted the repaired policy, and left matching configuration unchanged on repeat.

Evidence: repair-project-update.log, repair-project-repeat.log, repair-project-before.config, repair-project-after.config.

4. Explicit option takes precedence

Coverage: Boundary. Status: Passed.

Set the project channel to unknown-channel, then ran update with --channel pr-22182. Update succeeded, persisted the selected channel, and did not report that it was applying a channel from configuration.

Evidence: explicit-precedence-update.log.

5. AppHost-scoped configuration, not launch-directory configuration

Coverage: Boundary. Status: Passed.

Ran update from an unrelated directory whose config selected unknown-channel, passing an explicit AppHost path with configured pr-22182. The selected AppHost's configuration was used and update succeeded.

Evidence: scoped-configuration-update.log.

6. Unknown configured channel

Coverage: Unhappy path. Status: Passed.

Configured unknown-channel and ran update without a channel option. Exit code was 13, and the diagnostic identified Aspire configuration as the source. Top-level project, AppHost, JSON, and NuGet configuration bytes remained unchanged.

Evidence: unknown-channel-update.log.

7. MSBuild restore override

Coverage: Unhappy path. Status: Passed.

Configured pr-22182 on a project-based AppHost with RestoreSources overriding ambient NuGet configuration. Update exited 13, identified the override, and preserved project/configuration bytes.

Evidence: overridden-restore-update.log.

8. Unsafe user-owned feed policy

Coverage: Unhappy path. Status: Passed.

Registered the selected PR feed under a user-owned company alias with unrelated package mappings. Update exited 13, explained that the NuGet configuration requires manual editing, and preserved the original files.

Evidence: user-owned-feed-update.log.

9. Configured stable cleanup

Coverage: Happy path and notification boundary. Status: Passed.

Configured stable with an obsolete CLI-owned staging feed. Update removed that feed, restored using ambient internal-mirror policy, synchronized package/SDK metadata, removed the persisted stable channel, and did not display the configured-channel notification.

Evidence: stable-configured-update.log.

10. Guest AppHost notification

Coverage: Happy path. Status: Passed.

Created a fresh TypeScript AppHost using aspire-ts-empty, configured pr-22182, and updated it without --channel. Update succeeded and displayed:

Using channel 'pr-22182' from Aspire configuration. Pass --channel to override.

Evidence: guest-notification-create.log, guest-notification-update.log.

11. Configured stable matches explicit stable

Coverage: Equivalence boundary. Status: Passed.

Created a separate AppHost with equivalent obsolete feed policy and ran --channel stable. The resulting AppHost source, Aspire configuration JSON, and NuGet configuration matched the configured-stable result.

Evidence: stable-explicit-update.log.

12. No selected channel preserves native policy

Coverage: Compatibility boundary. Status: Passed.

Updated a fresh C# AppHost with no configured channel and no explicit channel option. The NuGet configuration bytes were preserved, no channel setting was introduced, and no configured-channel notification appeared.

Evidence: no-configured-channel-update.log.

Fixture corrections

The initial smoke harness accidentally duplicated an existing mapping entry and mixed macOS /tmp and /private/tmp spellings for the same feed. Those fixtures were corrected and rerun with fresh AppHosts and canonical paths. The final scenario results above are from the corrected runs, not from those invalid initial fixtures.

CI Findings

CI is not green. There are two failing E2E jobs, plus aggregate failure checks.

Config-source brownfield adoption needs updated test input

Status: Follow-up required for this PR.

The existing helper executes:

await _auto.TypeAsync("aspire update --yes");
// After configuration-source consent:
await _auto.WaitForSuccessPromptAsync(_counter, timeout: TimeSpan.FromMinutes(5));

Source: tests/Aspire.Cli.EndToEnd.Tests/Helpers/ConfigSourceTestContext.cs:353-362.

The failed job and TRX show Update_AcceptingConfigurationSourceUpdatesBrownfieldConfiguration timing out at:

Using channel 'pr-22182' from Aspire configuration. Pass --channel to override.
Which directory for NuGet.config file? (.../SourceApp):

The configured channel now correctly enters the explicit-channel NuGet workflow. --yes answers confirmation prompts, not the directory prompt, and the E2E helper does not provide or answer it. Adapt that helper to supply --nuget-config-dir or handle the existing prompt, then validate the test in CI. The test's final whole-config assertion should also be checked against any intended SDK metadata synchronization.

Evidence: ci/config-source-job.log, ci/config-source-results.trx.

Self-update test expects identity-based C# channel selection

Status: Existing-contract mismatch indicated; baseline execution not performed.

The test removes the project channel and later asserts that staging was persisted:

createdConfig.Remove("channel");
// Self-update and relaunch, then unqualified project update.
Assert.Equal("staging", updatedConfig["channel"]?.GetValue<string>());

Source: tests/Aspire.Cli.EndToEnd.Tests/SelfUpdateChannelPersistenceTests.cs:56-58,108-113.

The failed job reports expected staging, actual null. The downloaded recording shows the relaunched staging CLI reporting identity version 17.0.0, then:

aspire update --non-interactive --yes
Checking for updates...
Analyzing project...
Project is up to date! (no updates necessary)

The PR's parent already preserves native NuGet policy for C# updates with no explicit channel, and this PR preserves that behavior when no channel is configured. The failing assertion also occurs after the test has downloaded a staging CLI rather than while executing the PR CLI. These observations indicate a pre-existing test expectation/contract mismatch, but no baseline CI run was performed to conclusively establish attribution. The test should verify self-update channel persistence without relying on identity-driven C# project feed selection.

Evidence: ci/self-update-latest-job.log, ci/self-update-results.trx, ci/self-update-transcript.txt.

The general failed-job downloader encountered GitHub HTTP 502 responses while listing jobs. Direct job-log and artifact downloads succeeded.

Summary

Area Result
PR artifact identity Verified
Fresh AppHost lifecycle Passed
C# feed repair, both AppHost formats Passed
Matching policy remains byte-identical Passed
Explicit-option and AppHost-scope precedence Passed
Unknown channel and unsafe NuGet policy Passed; exit 13, original files preserved
Stable cleanup, silence, and explicit-option equivalence Passed
Guest notification Passed
No-channel native policy compatibility Passed
Config-source E2E Failed in CI; test-input adaptation required
Self-update E2E Failed in CI; existing-contract mismatch indicated

Overall Result

Local feature smoke testing passed: 12 cases. PR verification remains blocked by CI test compatibility issues.

No product or test source changes were made during this testing pass. No PR comments, review replies, issues, or CI reruns were posted or triggered.

Artifacts and Cleanup

  • Report: pr-22182-testing-report.md in the session's persistent files.
  • Logs and configuration evidence: pr-22182-testing-evidence/ beside this report.
  • Driver: pr-channel-smoke.py beside this report.
  • Screenshots were not needed for this text-only command behavior.
  • The test AppHost was stopped, its absence from aspire ps was verified, and the temporary installation and generated projects were removed after evidence preservation.
  • Posting this report to the PR requires separate user confirmation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@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.

🔵 Needs a closer look

A CLI E2E regression is missing for feed persistence when the configured channel differs from ambient NuGet policy and no channel or quality flag is supplied, including preservation when the preview is declined.

1 open issue
1 file not reviewed
  • src/Aspire.Cli/Resources/UpdateCommandStrings.Designer.cs: Generated file

Review effort: Balanced

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

Copy link
Copy Markdown
Contributor

Tests selector

3 / 101 PR test projects · 4 PR jobs, from 21 changed files.

Selected PR test projects (3 / 101)

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

Selected PR jobs (4)

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


How these were chosen — grouped by what changed

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

🔧 src/Aspire.Cli/Resources/UpdateCommandStrings.resx (changed source)
→ 1 directly: Infrastructure.Tests

🧪 tests/Aspire.Cli.EndToEnd.Tests/Helpers/ConfigSourceTestContext.cs (changed test)
→ 1 directly: Aspire.Cli.EndToEnd.Tests

🧪 tests/Aspire.Cli.EndToEnd.Tests/SelfUpdateChannelPersistenceTests.cs (changed test)
→ 1 directly: Aspire.Cli.EndToEnd.Tests

🧪 tests/Aspire.Cli.EndToEnd.Tests/UpdateChannelNuGetConfigOrderingTests.cs (changed test)
→ 1 directly: Aspire.Cli.EndToEnd.Tests

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

Job reasons

Job Triggered by
cli-starter-validation affected project Aspire.Cli
extension-e2e • src/Aspire.Cli/Commands/UpdateCommand.cs, src/Aspire.Cli/Projects/IAppHostProject.cs, src/Aspire.Cli/Resources/UpdateCommandStrings.Designer.cs, src/Aspire.Cli/Resources/UpdateCommandStrings.resx, src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.cs.xlf, src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.de.xlf, src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.es.xlf, src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.fr.xlf, src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.it.xlf, src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.ja.xlf, src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.ko.xlf, src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.pl.xlf, src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.pt-BR.xlf, src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.ru.xlf, src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.tr.xlf, src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.zh-Hans.xlf, src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.zh-Hant.xlf
• affected project Aspire.Cli
polyglot affected project Aspire.Cli
typescript-api-compat affected project Aspire.Cli

Selection computed for commit 790e223.

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.

🔵 Needs a closer look

A successful C# update removes the project’s stable channel override, causing the next plain update to select the global daily channel; the override must be preserved and covered by a consecutive-update regression test.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Preserve project channel overrides across updates

src/​Aspire.Cli/​Commands/​UpdateCommand.cs:462

With project "channel": "stable" and global "channel": "daily", a successful C# update removes the project override: ProjectUpdater.GetUpdateStepsAsync saves a null channel for stable. The next plain aspire update then selects daily instead. Preserve configuration-sourced stable overrides while applying stable NuGet cleanup, and add a regression covering two consecutive updates with conflicting project and global channels.

1 file not reviewed
  • src/Aspire.Cli/Resources/UpdateCommandStrings.Designer.cs: Generated file

Review effort: 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.

@karolz-ms
Karol Zadora-Przylecki (karolz-ms) merged commit 1dadd66 into main Nov 12, 2026
435 of 438 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 17.1 milestone Nov 12, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Pull request created: #2133

Generated by PR Documentation Check · copilot · auto · 24.1 AIC · ⌖ 1.17 AIC · ⊞ 7.4K

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

📝 Documentation has been drafted in microsoft/aspire.dev#2133 targeting release/17.0.

Updated aspire-update.mdx to document that aspire update honors the configured channel for C# AppHosts. Signals: cli_command_file_changed (UpdateCommand.cs), cli_resource_strings_changed (UpdateCommandStrings.resx), pr_body_has_cli_flag_mention (--channel/--quality), pr_body_has_user_facing_section.

Note

This draft PR needs human review before merging.

@danegsta

Copy link
Copy Markdown
Member Author

/backport to release/17.0

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/17.0 (link to workflow run)

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants