You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Honor configured channels when updating C# AppHosts - #22182
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:
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.
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.
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/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.
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.
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.
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.
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));
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.
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>());
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.
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.
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.
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.
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.
Port the ConfigSource E2E test fix from #22182 so brownfield source
adoption no longer assumes a fixed SDK version or JSON property order.
Add WaitForAspireUpdateCompletionAsync, which waits for the aspire update
command to finish and declines the optional post-update CLI self-update
confirmation when it appears. features.updateNotificationsEnabled does not
gate that prompt, so CentralPackageManagementTests and the
ChannelUpdateWorkflowTests stable-preview flow must handle both cases.
Co-authored-by: Copilot App <[email protected]>
## Description
Test-only change for `release/17.0`. It fixes CLI E2E failures that show
up on unrelated release PRs (for example #22401 and #22362). There are
no product changes.
**1. ConfigSource brownfield adoption test.** This ports only the
`ConfigSourceTestContext` test fix from #22182, which is already merged
on `main` and is also part of the open backport #22219.
`Update_AcceptingConfigurationSourceUpdatesBrownfieldConfiguration`
assumed the old SDK version and an exact JSON property order. With this
change, the test:
- runs `aspire update --yes --nuget-config-dir .`
- sets the expected `sdk.version` from the AppHost
- compares the result with `JsonNode.DeepEquals`
**2. Post-update CLI self-update prompt.** After the project update,
`aspire update` may ask `An update is available for the Aspire CLI.
Would you like to update it now? [Y/n]`.
`features.updateNotificationsEnabled` does not control this prompt. It
appears only when a newer CLI has been published on the selected
channel. Four tests blocked on it until they timed out:
-
`CentralPackageManagementTests.AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps`
-
`CentralPackageManagementTests.AspireUpdateRemovesOrphanAppHostPackageVersionWhenSdkAlreadyCurrent`
-
`ChannelUpdateWorkflowTests.UpdateToStable_TypeScriptSingleFileInit_KeepsConfigChannel`
-
`ChannelUpdateWorkflowTests.UpdateToStable_TypeScript_PreviewsStablePkgsAndKeepsChannel`
The new `CliE2EAutomatorHelpers.WaitForAspireUpdateCompletionAsync`
helper waits until one of three things appears for the current
`SequenceCounter` value:
- the success prompt
- the error prompt, which still fails fast
- the CLI self-update prompt
Only output after the line where the command was typed is considered, so
a prompt left on screen by an earlier `aspire update` in the same test
does not count. When the CLI self-update prompt appears, the helper
types `n` without Enter, so no phantom shell command desyncs the
counter, and then waits for the success prompt. It does not press Enter
blindly or use fixed delays, and it works whether or not the prompt
appears. The comments that claimed `updateNotificationsEnabled`
suppresses this prompt have been corrected.
### Validation
- `MSBUILDTERMINALLOGGER=false dotnet build
tests/Aspire.Cli.EndToEnd.Tests/Aspire.Cli.EndToEnd.Tests.csproj -v q
-nologo` succeeded with 0 warnings and 0 errors.
- The affected E2E tests were **not run locally**: they need Docker plus
a Linux CLI archive, and Docker isn't available on the authoring
machine. The CLI E2E jobs in this PR's CI provide that validation.
- Root cause comes from the asciinema recordings and TRX files of CI run
44398134189 (#22401). In all four failures the terminal is blocked at
the CLI self-update `[Y/n]` prompt.
Fixes # (issue)
## Checklist
- Is this feature complete?
- [x] Yes. Ready to ship.
- [ ] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
- [x] 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
- [x] 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
- [x] No
---------
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
…22219)
Backport of #22182 to release/17.0
Also backports #22207, #22355, and #22208 using their distinct
squash-merge changes, without replaying the stacked PR history.
/cc @danegsta
## Description
C# AppHost updates can ignore configured channels, and failed restores
can block channel updates while hiding actionable diagnostics. Honor
configured channels, separate applying channel updates from `--dry-run`
validation, and log/display native restore diagnostics with best-effort
credential redaction.
Normal channel updates apply confirmed edits without requiring a
validation restore. Explicit `--dry-run` validation uses isolated caches
and restore outputs, then restores the original source files. Updates
without a selected channel retain their existing restore behavior. These
changes do not fix underlying dependency conflicts or MSBuild task DLL
locks.
Relates to #22214 and #22352.
**Release prerequisite:** This backport is intended for 17.0.1.
`release/17.0` still has `PatchVersion=0` although stable v17.0.0 is
published. Advance the release branch to the next unshipped servicing
version in a separate PR; no version bump is included here.
## Checklist
- Is this feature complete?
- [x] Yes. Ready to ship.
- [ ] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
- [x] 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
- [x] No
- Does the change make any security assumptions or guarantees?
- [x] Yes
- If yes, have you done a threat model and had a security review?
- [ ] Yes
- [x] No
- [ ] No
## Customer Impact
Customers updating C# AppHosts can have their configured channel ignored
or lose candidate updates when dependency conflicts cause restore to
fail, with no useful restore diagnostics. The combined fixes honor the
configured channel, let customers apply channel updates independently of
validation, and expose actionable restore errors. Credential-bearing
package source URLs are redacted on a best-effort basis before
diagnostics are buffered or logged.
## Testing
`./restore.sh` - passed (13 existing package vulnerability warnings, 0
errors).
`git diff --check 38e4ce6..HEAD` - passed. Each of the three added
commits has the same stable patch ID as its source squash commit.
Focused CLI unit run on macOS ARM64 - **788 passed, 2 failed, 2
skipped**:
```shell
MSBUILDTERMINALLOGGER=false dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class '*.ProjectUpdater*' --filter-class '*.UpdateCommand*' --filter-class '*.ConfigSourceCommandTests' --filter-class '*.DotNetAppHostRestorePreviewTests' --filter-class '*.DotNetAppHostUpdateTransactionTests' --filter-class '*.DotNetCliRunnerTests' --filter-class '*.ProcessInvocationOptionsTests' --filter-class '*.NuGetClientTests' --filter-class '*.ProcessExecutionFactoryEnvironmentTests' --filter-class '*.PackageSourceRedactorTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'
```
Both failures were the native file-based restore theory, with
MSB4216/MSB4027 task-host errors caused by mixing the system .NET host
with the repository-local SDK. Rerunning only those cases with the
repository-local host on PATH **passed 2/2**, without code changes:
```shell
PATH="$PWD/.dotnet:$PATH" DOTNET_ROOT="$PWD/.dotnet" MSBUILDTERMINALLOGGER=false .dotnet/dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-method '*.UpdateAsync_FileBasedNativePackageMetadataEditsSourceAndRollsBackOnFailure' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'
```
Across the initial run and targeted retry, all **790 runnable cases
passed**. The two skips require Windows batch execution and a
case-sensitive filesystem, respectively.
E2E scenarios are included in the backport but were not run locally; CI
validation remains outstanding.
## Risk
Medium. This changes when C# channel updates restore and introduces
validation-only rollback and isolated caches/restore outputs. Updates
without a selected channel retain their restore behavior. Credential
redaction is best effort, not a security guarantee; logs should still be
checked before sharing. No supported library API changes or new
dependencies are introduced.
## Regression?
No.
---------
Co-authored-by: David Negstad <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: James Newton-King <[email protected]>
Co-authored-by: David Negstad <[email protected]>
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
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.
Description
C#
aspire updatecurrently ignores the Aspirechannelsetting unless a channel is passed on the command line. This can leavenuget.configout 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--channeland legacy--qualityoptions 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
stableapplies 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" }The update now behaves like
aspire update --channel dailyand reports:The existing command-line override remains available:
Relevant command help:
Validation
Passed: 400 tests, with one case-sensitive-filesystem test skipped on macOS:
CLI localization resources were refreshed successfully with:
Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?