Add Executable launch profile support to dotnet run and dotnet watch#51727
Merged
tmat merged 15 commits intoDec 12, 2025
Conversation
baronfel
requested changes
Nov 13, 2025
Copilot
AI
changed the title
[WIP] Allow dotnet run to use launch profiles for Executable
Add Executable launch profile support to dotnet run and dotnet watch
Nov 13, 2025
baronfel
reviewed
Nov 14, 2025
baronfel
reviewed
Nov 14, 2025
baronfel
reviewed
Nov 14, 2025
| } | ||
|
|
||
| private static ProjectLaunchSettingsModel? TryGetLaunchProfileSettings(string projectDirectory, string projectNameWithoutExtension, string appDesignerFolder, BuildOptions buildOptions, string? profileName) | ||
| private static LaunchSettingsModel? TryGetLaunchProfileSettings(string projectDirectory, string projectNameWithoutExtension, string appDesignerFolder, BuildOptions buildOptions, string? profileName) |
Member
There was a problem hiding this comment.
@dotnet/dotnet-testing if we expand the 'launch settings' handlers that are known, how should the testing experience react? does test support launch settings profiles today?
baronfel
approved these changes
Nov 14, 2025
3 tasks
tmat
reviewed
Nov 14, 2025
tmat
reviewed
Nov 14, 2025
a602ef8 to
535b6ae
Compare
Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
- Created base LaunchSettingsModel with ProfileKind discriminator - Derived ProjectLaunchSettingsModel and ExecutableLaunchSettingsModel - Added JSON binding models for deserialization - Updated providers to use JsonSerializer.Deserialize instead of manual traversal - Exposed SupportedProfileTypes from LaunchSettingsManager - Updated LaunchSettingsProfile.cs to use array of supported types with comment - Updated RunCommand to use pattern matching on ProfileKind - Split Execute method into ExecuteWithProjectProfile and ExecuteWithExecutableProfile - Updated all method signatures to use base LaunchSettingsModel type Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Changed hardcoded error message to use CliCommandStrings.LaunchProfileHandlerCannotBeLocated for proper localization support. Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Simplified argument building logic to make it clearer that ApplicationArgs are properly escaped before being combined with launchSettings.CommandLineArgs. Added comments explaining that CommandLineArgs from JSON cannot be reliably parsed into tokens. Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Extracted the common code from ExecuteWithProjectProfile and ExecuteWithExecutableProfile into a new ExecuteCommand method. This method handles: - Applying launch settings to the command - Applying environment variables from command line - Sending telemetry - Setting up Ctrl-C handler - Executing the command This reduces code duplication and makes the execution flow clearer. Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Added tests to verify that the executable command handler correctly applies: - Environment variables from launch profile - Working directory settings - Command line arguments combination (profile + command line) - Environment variable expansion in executable paths Created new test assets: - AppForExecutableProfile: Helper app to verify environment and arguments - AppWithDetailedExecutableProfile: Test project with various executable profiles All tests verify the correct application of launch profile settings to the generated command. Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
535b6ae to
8bf8f0d
Compare
MiYanni
approved these changes
Dec 11, 2025
MiYanni
left a comment
Member
There was a problem hiding this comment.
Just a comment on the JSON serialization design but looks good overall.
Member
|
/ba-g WinRT test |
This was referenced Feb 12, 2026
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.
Refactors launch profile parsing and adds support for
Executablecommand name.Fixes environment variable expansion and adds tests.