views:

168

answers:

2

Hi,

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.

A: 

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.

Konamiman
I'm looking for a generic keyboard shortcut that doesn't require me to define a configuration for every project I want to build.
Danra
+1  A: 

That macro ought to do it:

Sub Build_Startup()
    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.

Bahbar
Great, it works!!But... It doesn't display anything on the output console... Any way to change that?
Danra
It displays the standard build output in the build output pane for me. What kind of output are you looking for ? You can add your own output in the macro with the help of GetWindowOutputPane and OutputItem functions that are available in the macros samples (Samples/Utilities).
Bahbar
My mistake, output is indeed displayed properly. Thanks!
Danra