Skip to content

Conversation

@adamint
Copy link
Member

@adamint adamint commented Oct 31, 2025

Description

  • Fixes inaccuracies with the dotnet debugger extension, specifically in launch profile environment variable precedence.
  • Enables run/debug apphost command for apphost.cs files
  • Adds some logging in the extension and streams dotnet build output to debug console
  • Always builds dotnet file based apps in the extension instead of CLI (this includes apphosts). If dev kit is installed, its build task will be used. Otherwise, dotnet build will be.

With these changes, AddCSharpApp works! try the FileBasedApps playground project

Fixes #12489

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

@github-actions
Copy link
Contributor

github-actions bot commented Oct 31, 2025

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12568

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12568"

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@adamint adamint requested a review from eerhardt November 3, 2025 20:16
Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@adamint adamint merged commit 5fe5c35 into dotnet:main Nov 3, 2025
296 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 13.1 milestone Nov 3, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Dec 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add VSCode debugging support for AddCSharpProject working

3 participants