Support AddCSharpApp, fix some rough edges around project resources#12568
Merged
adamint merged 13 commits intodotnet:mainfrom Nov 3, 2025
Merged
Support AddCSharpApp, fix some rough edges around project resources#12568adamint merged 13 commits intodotnet:mainfrom
adamint merged 13 commits intodotnet:mainfrom
Conversation
…ofile if none is specified. Also apply dotnet run-api environment variables before DCP environment
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12568Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12568" |
davidfowl
reviewed
Oct 31, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for single-file Aspire app hosts (apphost.cs files) in both the CLI and VS Code extension. The changes enable building, debugging, and running single-file apps that use the dotnet run-api command to determine their executable path and environment variables.
Key changes:
- CLI now conditionally builds app hosts based on whether it's a single-file app and whether running in extension host mode
- VS Code extension detects apphost.cs files and provides run/debug buttons in the editor
- Extension implements fallback to dotnet CLI build when C# Dev Kit is unavailable
- Launch profile handling enhanced to support single-file apps and properly merge environment variables from multiple sources
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Aspire.Cli/Projects/ProjectLocator.cs | Debug console output added (should be removed) |
| src/Aspire.Cli/Commands/RunCommand.cs | Simplified build logic to only build non-single-file apps when not in extension host mode |
| playground/FileBasedApps/apphost.cs | Added SDK directive comment for Aspire CLI |
| extension/src/test/launchProfiles.test.ts | Added comprehensive test coverage for launch profile selection and environment variable merging |
| extension/src/test/dotnetDebugger.test.ts | Updated tests to pass AspireDebugSession instance |
| extension/src/loc/strings.ts | Added new error message string |
| extension/src/editor/AspireEditorCommandProvider.ts | Detects apphost.cs files and enables run/debug commands for them |
| extension/src/debugger/launchProfiles.ts | Added support for single-file app launch settings and environment variable merging from run API |
| extension/src/debugger/languages/dotnet.ts | Implemented dotnet CLI build fallback and run-api support for single-file apps |
| extension/src/debugger/AspireDebugSession.ts | Added CLI debug logging flag support |
| extension/src/dcp/types.ts | Added debugSession to LaunchOptions |
| extension/src/dcp/AspireDcpServer.ts | Removed noisy warning log, passed debugSession to configuration |
| extension/src/capabilities.ts | Exported isCsDevKitInstalled function |
| extension/package.nls.json | Added localization for build error message |
| extension/package.json | Updated when clauses for run/debug buttons |
| extension/loc/xlf/aspire-vscode.xlf | Added translation unit for new error message |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…m/adamint/aspire into dev/adamint/support-sfa-resources
16 tasks
eerhardt
reviewed
Nov 3, 2025
eerhardt
reviewed
Nov 3, 2025
eerhardt
reviewed
Nov 3, 2025
eerhardt
reviewed
Nov 3, 2025
eerhardt
reviewed
Nov 3, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
With these changes, AddCSharpApp works! try the FileBasedApps playground project
Fixes #12489
Checklist
<remarks />and<code />elements on your triple slash comments?doc-ideatemplatebreaking-changetemplatediagnostictemplate