-
Notifications
You must be signed in to change notification settings - Fork 856
aspire update --channel daily fails because nuget.config is modified before packages are updated #15891
Description
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
- Create an Aspire project with multiple Aspire package references (e.g.,
Aspire.Hosting.JavaScript,Aspire.Hosting.Python,Aspire.Hosting.Redis) at a stable version like13.2.1 - Run
aspire update --channel daily - Confirm the updates when prompted
Expected Behavior
All packages are updated to the daily preview version successfully.
Actual Behavior
The CLI:
- Finds 3 packages to update (e.g.,
13.2.1→13.3.0-preview.1.26203.21) - Prompts for a NuGet.config directory and writes/modifies the nuget.config with a
packageSourceMappingthat restrictsAspire*packages to thedotnet9feed - Attempts to update packages one at a time via
dotnet package add - The first
dotnet package addtriggers a full NuGet restore, which fails because the other packages are still at13.2.1— a stable version that doesn't exist on thedotnet9feed
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 failingdotnet package addprocess, 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