blog

I like to blog about current software design and development projects, as well as general everyday news and events. I'm passionate about what I do and you can follow my personal journey through my blog. I'm constantly on the lookout for new development techniques and technologies to keep on top of the changing market, so if I do miss anything feel free to leave me a comment.

Posts Tagged ‘Macros’

Visual Studio: How to build only the StartUp project

Friday, October 10th, 2008

Have you ever found yourself working on a Visual Studio solution consisting of multiple projects and wanting to build only the start-up project using a shortcut key?

Unfortunately for some bizarre reason Visual Studio 2005 and 2008 do not have this feature by default.  However, there is a simple solution to this. Create a macro and assign it a shortcut key.

First create a new macro module though Tools > Macros with the following code

1
2
3
4
5
6
7
8
9
10
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports System.Diagnostics
 
Public Module BuildStartup
    Sub BuildStartup()
        DTE.Solution.SolutionBuild.BuildProject(DTE.Solution.SolutionBuild.ActiveConfiguration.Name, DTE.Solution.SolutionBuild.StartupProjects(0), False)
    End Sub
End Module

Now that you have the macro, you simply assign it a shortcut key through Tools > Options.  Look for “Keyboard” under “Environment”.  Find your macro in the command list and assign it a shortcut key.

Enjoy.