Re-enable version-aware auto-restore for guest AppHosts
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Is your feature request related to a problem? Please describe the problem.
The VS Code extension's `aspire.enableAutoRestore` setting is disabled by default because auto-restore previously ran on every workspace open and configuration change. That could start redundant restores, conflict with commands such as `aspire add`, and surface locked-file failures, as reported in #16338.
Non-.NET AppHosts still depend on generated modules under `.aspire/modules` (or the legacy `.modules` layout). Those modules can become stale when the selected Aspire CLI changes, while the Aspire tree has no targeted restore action for an individual non-C# AppHost.
### Describe the solution you'd like
Re-enable `aspire.enableAutoRestore` by default with narrower, version-aware behavior:
- Stamp guest AppHost generated modules with the exact Aspire CLI identity that generated them.
- Advertise marker support as a CLI capability so newer extensions remain compatible with older CLIs.
- In trusted workspaces, automatically restore only non-.NET AppHosts that already have generated modules and whose marker is missing or differs from the selected CLI version.
- Skip automatic restore for .NET AppHosts, missing module trees, unsupported older CLIs, and untrusted workspaces.
- Recheck when the workspace opens or the selected CLI/workspace folders change, rather than restoring on every `aspire.config.json` edit.
- Add a **Restore AppHost** child node for idle non-C# AppHosts that runs `aspire restore --apphost ` with the CLI selected for that workspace folder.
- Support both `.aspire/modules` and the legacy `.modules` TypeScript layout.
### Additional context
The original auto-restore behavior was introduced in #15546 and disabled by #16658 to address #16338. The version marker should make the default behavior durable without restoring every guest AppHost in large monorepos. AppHosts with no generated modules can use the explicit tree action instead of being restored automatically.
Contributor guide
Research direction
Start in the VS Code extension's auto-restore behavior and Aspire tree handling, then trace the selected CLI and the `aspire restore --apphost ` command. Done means version-aware markers and capability detection support both module layouts, automatic restore is limited to the stated cases, and the Restore AppHost child action works for idle non-C# AppHosts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, typescript, vscode
- Domain
- cli, developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100