Keyboard shortcut to build only startup project?

You can use "Build Only Startup Project" extension on VS 2019 and VS 2022.

Also to assigne keyboard shorcut, you can check "Build.BuildOnlyStartupProject" shortcut.


That macro ought to do it:

Sub Build_Startup()
    DTE.ToolWindows.OutputWindow.Parent.Activate()
    Dim sb As SolutionBuild2 = DTE.Solution.SolutionBuild
    For Each item In sb.StartupProjects
        sb.BuildProject(sb.ActiveConfiguration.Name, item, True)
    Next
End Sub

Just put that in your macros - using the Macros IDE Alt + F11, and add a keyboard mapping to it (Tools/Customize/Commands/Keyboard, find your new command in the Macros. namespace), and you're all set.


You could create a custom solution configuration that only builds the project you want (named for example "StartupOnly"). By default Visual Studio shows a combo in the toolbar that allows to quickly switch between different configurations, so all you would need is to select that configuration and use the regular build command.