microsoft / microsoft/aspire

aspire update should warn about stale #:package versions in apphost.cs

Open
#14,435 0 comments 0 reactions 0 assignees View on GitHub
area-cli
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is your feature request related to a problem?

When upgrading the Aspire CLI (e.g., from 13.1.0 to 13.2.0-preview.1), the `#:package` directives in `apphost.cs` still reference the old version. Running the app produces confusing errors until you manually update the version strings.

`aspire doctor` eventually catches the mismatch, but only if you think to run it. The natural flow is: upgrade CLI → run app → get errors → spend time debugging → eventually discover the version mismatch.

### Describe the solution you'd like

1. **`aspire run` should warn** when it detects a version mismatch between the CLI/SDK and the `#:package` directives in apphost.cs. Something like:
> ⚠️ Your apphost.cs references Aspire.Hosting.AppHost@13.1.0 but the CLI is 13.2.0-preview.1. Run `aspire update` to fix.

2. **`aspire update` should offer to update apphost.cs** — it currently updates the CLI and some packages in referenced projects, but doesn't touch the `#:package` directives in the single-file apphost format.

### Describe alternatives you've considered

- Running `aspire doctor` after every upgrade (works but not discoverable)
- Manually editing `#:package` versions (error-prone)

### Additional context

Discovered during a project using the single-file apphost format (`#:sdk` / `#:package` directives). The version mismatch between CLI 13.2.0-preview.1 and packages at 13.1.0 produced build errors that weren't obviously version-related.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.