Skip to content

aspire update --channel daily fails because nuget.config is modified before packages are updated #15891

@davidfowl

Description

@davidfowl

aspire update --channel daily fails because nuget.config is modified before packages are updated

Description

aspire update --channel daily fails with NU1103 errors when updating a project with multiple Aspire package references. The CLI modifies the nuget.config (adding a feed with packageSourceMapping for Aspire*) before updating the package references, then updates packages one at a time. This causes NuGet restore to fail because the not-yet-updated packages (still at their old stable version) can't be resolved from the newly configured feed.

Steps to Reproduce

  1. Create an Aspire project with multiple Aspire package references (e.g., Aspire.Hosting.JavaScript, Aspire.Hosting.Python, Aspire.Hosting.Redis) at a stable version like 13.2.1
  2. Run aspire update --channel daily
  3. Confirm the updates when prompted

Expected Behavior

All packages are updated to the daily preview version successfully.

Actual Behavior

The CLI:

  1. Finds 3 packages to update (e.g., 13.2.113.3.0-preview.1.26203.21)
  2. Prompts for a NuGet.config directory and writes/modifies the nuget.config with a packageSourceMapping that restricts Aspire* packages to the dotnet9 feed
  3. Attempts to update packages one at a time via dotnet package add
  4. The first dotnet package add triggers a full NuGet restore, which fails because the other packages are still at 13.2.1 — a stable version that doesn't exist on the dotnet9 feed
error NU1103:
  Unable to find a stable package Aspire.Hosting.Python with version (>= 13.2.1)
    - Found 2552 version(s) in https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json
      [ Nearest version: 13.3.0-preview.1.26111.5 ]
    - Versions from https://api.nuget.org/v3/index.json were not considered

error NU1103:
  Unable to find a stable package Aspire.Hosting.Redis with version (>= 13.2.1)
    - Found 2573 version(s) in https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json
      [ Nearest version: 13.3.0-preview.1.26111.5 ]
    - Versions from https://api.nuget.org/v3/index.json were not considered

The packageSourceMapping prevents nuget.org from being used as a fallback for the old stable versions.

Root Cause

The nuget.config is modified before any package references are updated. Since packages are updated one at a time (each triggering a full restore), the remaining packages at their old stable versions can't be resolved from the new feed configuration. Reordering the individual package updates doesn't help — whichever package is updated first, the others will still fail to restore.

Possible Fixes

  • Update all package references in the project file first, then modify the nuget.config, then restore once
  • Defer the nuget.config change until after all package references have been updated
  • Update all packages atomically in a single operation rather than one at a time

Additional Notes

  • The CLI log (--debug) does not capture the stdout/stderr from the failing dotnet package add process, making this harder to diagnose. The log says "See debug logs for more details" but the debug logs don't contain the actual NuGet error output.
  • CLI version: 13.3.0-preview.1.26203.21
  • Exit code: 13

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions