Skip to content

fix(solution): resolve startup project selection and launch - #123

Open
wd357dui wants to merge 1 commit into
CodingWithCalvin:mainfrom
wd357dui:fix/solution/startup-project-selection
Open

wd357dui wants to merge 1 commit into
CodingWithCalvin:mainfrom
wd357dui:fix/solution/startup-project-selection

Conversation

@wd357dui

@wd357dui wd357dui commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Important

Behavior change: When projectName is supplied to debugger_launch or debugger_launch_without_debugging, the requested project becomes the solution’s startup project and remains so after launch. This replaces the previous behavior, which promised not to change the startup project. Calls without projectName still launch the current startup project.

Issue A and fix

startup_project_set wrote the display name straight into SolutionBuild.StartupProjects, which only accepts a UniqueName. The tool ignored an unresolvable value without raising an error, so it reported success even though nothing changed.

While the setter and the launch tools all take display names, startup_project_get returned the raw UniqueName.

To address this, both tools now resolve projects the same way project_list does: the setter accepts a display name or a UniqueName, writes the UniqueName, and reads the saved value back to confirm it was applied; the getter translates the saved UniqueName back to the display name.

Issue B and fix

debugger_launch(projectName) and debugger_launch_without_debugging(projectName) never started the requested project either.

They resolved the project and its configuration through IVsDebuggableProjectCfg, which the configuration object of an SDK-style (Common Project System) project does not implement, so the call always failed and the tool reported "Use project_list to verify the project name" no matter what the real cause was.

To address this, these tools now set the requested project as the startup project, leave it set, and say so in their descriptions and success messages. A failure now returns the actual reason instead of a name hint: no solution open, unknown project name, a debug session already running, the startup project not being applied, or the exception message.

Type of Change

  • fix - Bug fix

Related Issues

#49

Checklist

  • My code follows the project's code style
  • I have tested my changes locally
  • I have updated documentation if needed
  • My commits follow the conventional commit format
  • This PR has a descriptive title using conventional commit format

Screenshots (if applicable)

N/A

Additional Notes

Verified locally on Visual Studio 2026 against a solution containing more than one launchable project: the getter returns a display name, the setter accepts it (and rejects an unknown name), and the launch tools start the requested project, confirmed by the process path and by the startup project changing to it.

…l launch errors

startup_project_set passed the display name straight to
SolutionBuild.StartupProjects, which expects a UniqueName and silently
ignored anything else, while startup_project_get returned that UniqueName.
Both tools now resolve projects the same way project_list does: the display
name is translated to a UniqueName before writing, the saved value is read
back, and the read side translates it back to the display name.

debugger_launch(projectName) never started the requested project. Its
IVsDebuggableProjectCfg path resolves the project and its configuration
correctly, but the configuration object of an SDK-style project does not
implement IVsDebuggableProjectCfg, so the call always failed and reported
the misleading "Use project_list to verify the project name".

SDK-style projects therefore have to be launched through the solution's
startup project. The command that starts a build or debug session returns
before Visual Studio resolves the startup project, so a temporary swap
cannot be undone without launching the wrong project. The tool now sets the
requested project as the startup project and leaves it set; the tool
descriptions and success messages say so. Failures return the real reason
(unknown project, active debug session, startup project not applied, or the
exception message) instead of a generic name hint.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant