Pass open AppHost to CLI commands via --project flag#14688
Merged
adamint merged 3 commits intodotnet:release/13.2from Mar 2, 2026
Merged
Pass open AppHost to CLI commands via --project flag#14688adamint merged 3 commits intodotnet:release/13.2from
adamint merged 3 commits intodotnet:release/13.2from
Conversation
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14688Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14688" |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the VS Code extension’s Aspire CLI command invocations to automatically pass the currently resolved AppHost via --project <path>, prioritizing the active editor AppHost over .aspire/settings.json, so the CLI doesn’t need to re-scan the workspace.
Changes:
- Added an AppHost argument helper (
getProjectArgs) for building--projectargs. - Extended
AspireTerminalProvider.sendAspireCommandToAspireTerminalto accept additional CLI args. - Updated
add,update,deploy, andpublishcommand registrations/implementations to pass resolved AppHost context.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| extension/src/utils/appHostArgs.ts | Adds helper to produce --project args from the resolved AppHost path. |
| extension/src/utils/AspireTerminalProvider.ts | Allows sending additional args when composing terminal CLI commands. |
| extension/src/extension.ts | Wires updated commands to pass AspireEditorCommandProvider for AppHost resolution. |
| extension/src/editor/AspireEditorCommandProvider.ts | Exposes getAppHostPath() and broadens AppHost detection heuristics. |
| extension/src/commands/add.ts | Passes resolved --project args to aspire add. |
| extension/src/commands/update.ts | Passes resolved --project args to aspire update. |
| extension/src/commands/deploy.ts | Passes resolved --project args to aspire deploy. |
| extension/src/commands/publish.ts | Passes resolved --project args to aspire publish. |
199fb40 to
4ec06e2
Compare
Member
Author
|
@copilot open a new pull request to apply changes based on the comments in this thread |
eerhardt
approved these changes
Mar 2, 2026
radical
reviewed
Mar 2, 2026
radical
approved these changes
Mar 2, 2026
f110896 to
0658245
Compare
When the user has an AppHost file open in the editor or configured in .aspire/settings.json, the extension now passes --project <path> to CLI commands that support it (deploy, publish, add, update). Fixes dotnet#11024
…utablePath - Change CLI flag from --project to --apphost to match current CLI interface - Rename getProjectArgs to getAppHostArgs for consistency - Tests already updated to stub vscode.workspace.getConfiguration instead of resolveCliPath
0658245 to
3149868
Compare
mitchdenny
pushed a commit
that referenced
this pull request
Mar 5, 2026
* Pass open AppHost to CLI commands via --project flag When the user has an AppHost file open in the editor or configured in .aspire/settings.json, the extension now passes --project <path> to CLI commands that support it (deploy, publish, add, update). Fixes #11024 * Address review feedback: proper arg escaping, raw tokens, tighter AppHost heuristic * Fix --project to --apphost and update tests for sync getAspireCliExecutablePath - Change CLI flag from --project to --apphost to match current CLI interface - Rename getProjectArgs to getAppHostArgs for consistency - Tests already updated to stub vscode.workspace.getConfiguration instead of resolveCliPath
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When CLI commands like
deploy,publish,add, andupdateare invoked from the VS Code extension, they now automatically pass--project <path>to the Aspire CLI if an AppHost is available. The AppHost is resolved with the following priority:.csfile (detected by the#:sdk Aspire.AppHost.Sdkmarker).aspire/settings.jsonhas a configuredappHostPathPreviously, these commands sent bare CLI commands (e.g.,
aspire deploy) without any project context, requiring the CLI to search the workspace from scratch — even when the user already had the AppHost open.Commands updated
deploy— accepts--projectviaPipelineCommandBasepublish— accepts--projectviaPipelineCommandBaseadd— accepts--projectviaAddCommandupdate— accepts--projectviaUpdateCommandCommands NOT changed (by design)
new/init— create new projects; don't operate on existing AppHostsopenTerminal,configureLaunchJson,settings,openLocalSettings,openGlobalSettings— configuration/utility commandsrunAppHost/debugAppHost— already used the open AppHostChanges
getAppHostPath()as a public method onAspireEditorCommandProvider(reuses existing resolution logic fromtryExecuteRunAppHost)additionalArgsparameter tosendAspireCommandToAspireTerminalappHostArgs.tsutility for building--projectargumentsFixes #11024
Checklist