Skip to content

Honor selected launch profile in bundled dotnet run - #19958

Open
Irakli Gabisonia (gabisonia) wants to merge 1 commit into
microsoft:mainfrom
gabisonia:fix/19867-bundled-launch-profile
Open

Honor selected launch profile in bundled dotnet run#19958
Irakli Gabisonia (gabisonia) wants to merge 1 commit into
microsoft:mainfrom
gabisonia:fix/19867-bundled-launch-profile

Conversation

@gabisonia

Copy link
Copy Markdown

Description

With CLI bundles enabled, dotnet run --launch-profile http delegates to aspire run. The .NET SDK passes the selected profile through DOTNET_LAUNCH_PROFILE, but the Aspire launcher ignored it and selected the first profile again.

Use the effective DOTNET_LAUNCH_PROFILE value when no explicit Aspire launch-profile option is provided. This preserves the selection for both direct AppHost launch and the fallback to dotnet run; an explicit --launch-profile still takes precedence.

Fixes #19867

Validation

  • Reproduced three failing regression cases before the fix: inherited selection, context environment selection, and a missing inherited profile silently falling back to the default.
  • AppHost launcher unit tests: 154 passed, 1 skipped because the local filesystem is case-insensitive.
  • Full build and package generation: passed with no warnings or errors.
  • Both LaunchProfileTests end-to-end cases passed in Linux ARM64 Docker containers using a locally built CLI bundle. They run aspire run --launch-profile E2E and dotnet run --launch-profile E2E /p:AspireUseCliBundle=true, asserting the profile name, environment, application URL, and arguments observed by the running AppHost.

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
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
    • No

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🚀 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/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19958

Or

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The precedence behavior is correctly implemented with focused unit and end-to-end regression coverage.

Pull request overview

Honors the launch profile selected by the .NET SDK when bundled execution delegates to Aspire.

Changes:

  • Uses DOTNET_LAUNCH_PROFILE when no explicit Aspire option is provided.
  • Adds unit coverage for precedence, defaults, and missing profiles.
  • Extends CLI end-to-end coverage to bundled dotnet run.
File summaries
File Description
src/Aspire.Cli/Projects/DotNetAppHostProject.cs Resolves the effective launch profile.
tests/Aspire.Cli.Tests/Projects/DotNetAppHostProjectTests.cs Tests profile selection and fallback behavior.
tests/Aspire.Cli.EndToEnd.Tests/LaunchProfileTests.cs Verifies explicit and bundled launch paths.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@gabisonia

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dotnet run --launch-profile ignored when AspireUseCliBundle is true

2 participants