Skip to content

Use pinned CLI version for staging channel in shared feed mode#14469

Merged
joperezr merged 6 commits intodotnet:release/13.2from
joperezr:FixStagingChannel
Feb 13, 2026
Merged

Use pinned CLI version for staging channel in shared feed mode#14469
joperezr merged 6 commits intodotnet:release/13.2from
joperezr:FixStagingChannel

Conversation

@joperezr
Copy link
Member

@joperezr joperezr commented Feb 12, 2026

Summary

When the staging channel is configured with overrideStagingQuality=Prerelease and no explicit feed override, the staging channel now uses the shared dotnet9 daily feed instead of constructing SHA-specific darc-pub-* feeds (which only exist for stable-quality builds). Additionally, a new stagingPinToCliVersion config flag pins all package versions to the CLI's own assembly version, bypassing dotnet package search entirely.

Problem

The staging channel normally builds SHA-specific feeds (darc-pub-dotnet-aspire-{hash}), but these are only created for stable-quality DARC builds. When builds aren't marked stable yet, the packages are only available on the shared dotnet9 daily feed. Even after switching to the shared feed, dotnet package search only returns the latest version per package ID per source — so when the feed contains both 13.2.x (staging) and 13.3.x (daily) packages, staging users would always get 13.3.x versions, which is wrong.

Solution

Two complementary features controlled by config flags:

1. Shared Feed Mode

When overrideStagingQuality is set to Prerelease (or Both) and overrideStagingFeed is not set, the staging channel uses the shared dotnet9 feed URL and sets configureGlobalPackagesFolder: false (no package isolation needed).

2. Pinned Version Mode (stagingPinToCliVersion)

When stagingPinToCliVersion=true is additionally set, all package versions are pinned to the CLI's own assembly version (with +buildmetadata stripped):

  • Templates (aspire new): Returns a synthetic Aspire.ProjectTemplates package with the CLI's version — no NuGet search at all
  • Integrations (aspire add): Still searches the feed to discover package IDs, but overrides the version on all results
  • Specific packages (aspire update): Returns a synthetic package with the pinned version
  • Self-update (aspire update --self): Unaffected — uses CliDownloader (URL-based), not NuGet search

Configuration

// ~/.aspire/settings.json or .aspire/settings.json
{
  "features": { "stagingChannelEnabled": true },
  "overrideStagingQuality": "Prerelease",
  "stagingPinToCliVersion": "true"
}

Changes

Production code

  • PackagingService.csCreateStagingChannel() computes useSharedFeed and pinnedVersion; new GetStagingPinnedVersion() helper
  • PackageChannel.cspinnedVersion constructor parameter with short-circuits in GetTemplatePackagesAsync, GetIntegrationPackagesAsync, and GetPackagesAsync
  • DotNetCliRunner.cs, NuGetPackageCache.cs, BundleNuGetPackageCache.cs — Cleanup of previously reverted exact-match plumbing

Schemas

  • aspire-global-settings.schema.json and aspire-settings.schema.json — Added overrideStagingFeed, overrideStagingQuality, and stagingPinToCliVersion properties

Tests

  • 22 staging-related tests covering shared feed behavior, pinned version config, and pinned version package resolution
  • Cleanup of stale exactMatch parameters across 14 test fake implementations

…is set

   dotnet package search only returns the latest version per package ID,
   so when the shared dotnet9 feed has both 13.2 and 13.3 prerelease
   packages, only 13.3 is returned. The stagingVersionPrefix filter then
   discards it, resulting in "no templates found".

   When VersionPrefix is set on a channel, pass --exact-match to get all
   versions from the feed, enabling the prefix filter to find the correct
   version line. Also update ParsePackageSearchResults to handle the
   "version" JSON field used by --exact-match (vs "latestVersion" in
   normal search).
@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

🚀 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/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14469

Or

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes staging channel template discovery when a feed contains multiple version lines by enabling dotnet package search --exact-match whenever a channel VersionPrefix is configured, and updating parsing to handle the JSON shape returned by exact-match search.

Changes:

  • Plumb an exactMatch flag through the NuGet package cache and dotnet CLI runner, and add --exact-match when appropriate.
  • Update ParsePackageSearchResults to read either latestVersion or version from search results.
  • Update/fix tests and add new staging channel coverage for version-prefix filtering scenarios.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/Aspire.Cli.Tests/Utils/CliUpdateNotificationServiceTests.cs Fixes a comment typo and updates INuGetPackageCache test stub signatures to include exactMatch.
tests/Aspire.Cli.Tests/TestServices/TestDotNetCliRunner.cs Extends the test runner’s package-search callback/signature to accept exactMatch.
tests/Aspire.Cli.Tests/TestServices/FakeNuGetPackageCache.cs Updates fake cache interface methods to accept exactMatch.
tests/Aspire.Cli.Tests/Templating/DotNetTemplateFactoryTests.cs Updates fakes/stubs for the new cache/runner signatures.
tests/Aspire.Cli.Tests/Projects/ProjectUpdaterTests.cs Updates SearchPackagesAsyncCallback lambdas to match the new signature.
tests/Aspire.Cli.Tests/Projects/AppHostServerProjectTests.cs Updates fake cache methods to accept exactMatch.
tests/Aspire.Cli.Tests/Packaging/PackagingServiceTests.cs Adds tests validating staging VersionPrefix filtering across mixed version lines; updates fake cache signatures.
tests/Aspire.Cli.Tests/Packaging/PackageChannelTests.cs Updates fake cache signatures to accept exactMatch.
tests/Aspire.Cli.Tests/Packaging/NuGetConfigMergerTests.cs Updates fake cache signatures to accept exactMatch.
tests/Aspire.Cli.Tests/Packaging/NuGetConfigMergerSnapshotTests.cs Updates fake cache signatures to accept exactMatch.
tests/Aspire.Cli.Tests/NuGet/NuGetPackageCacheTests.cs Updates SearchPackagesAsyncCallback lambdas to match the new signature.
tests/Aspire.Cli.Tests/Mcp/MockPackagingService.cs Updates mock cache signatures to accept exactMatch.
tests/Aspire.Cli.Tests/Commands/NewCommandTests.cs Updates package-search callback lambdas and fake cache methods for new signatures.
tests/Aspire.Cli.Tests/Commands/InitCommandTests.cs Updates package-search callback lambdas and fake cache methods for new signatures.
tests/Aspire.Cli.Tests/Commands/AddCommandTests.cs Updates package-search callback lambdas to match the new signature.
src/Shared/PackageUpdateHelpers.cs Makes parsing resilient to latestVersion vs version property differences.
src/Aspire.Cli/Packaging/PackageChannel.cs Enables exact-match searches for template packages when VersionPrefix is set.
src/Aspire.Cli/NuGet/NuGetPackageCache.cs Adds exactMatch support to cache lookups and passes it through to the CLI runner; adjusts cache key/paging behavior.
src/Aspire.Cli/NuGet/BundleNuGetPackageCache.cs Updates interface signatures to accept exactMatch (but currently doesn’t use it).
src/Aspire.Cli/DotNet/DotNetCliRunner.cs Adds --exact-match to dotnet package search and includes it in the disk cache key.

@joperezr
Copy link
Member Author

Found an issue with this approach. aspire add won't work as intended any more, as this fix only addresses aspire new and template acquisition. I'm working on an alternative fix and will push a change to this PR.

When the staging channel is configured with Prerelease quality and no
explicit feed override, packages are now pinned to the CLI's own version
instead of searching NuGet. This avoids the dotnet package search
limitation where only the latest version per package ID is returned,
which caused version mismatches when the shared feed contains packages
from multiple version lines (e.g. 13.2.x and 13.3.x).

New config flag stagingPinToCliVersion (boolean) controls this behavior.
When enabled alongside overrideStagingQuality=Prerelease:
- Templates (aspire new): synthetic result with CLI version
- Integrations (aspire add): discovers packages then overrides version
- Specific packages (aspire update): synthetic result with CLI version

Also cleans up reverted exact-match parameter plumbing from interfaces
and test fakes.
@joperezr joperezr changed the title Use --exact-match in dotnet package search when stagingVersionPrefix is set Use pinned CLI version for staging channel in shared feed mode Feb 12, 2026
@mitchdenny
Copy link
Member

/azp run dotnet.aspire

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@joperezr joperezr merged commit e758ef2 into dotnet:release/13.2 Feb 13, 2026
675 of 679 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 13.2 milestone Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants