R – Keyboard shortcut to build only startup project

buildkeyboard shortcutsvisual-studio-2008

I've tried to find a keyboard shortcut to build only the startup project In VS2008.

I only found a configurable shortcut to build the project which is currently viewed, which isn't as good.

Any ideas?

Thanks.

Best Answer

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.