Visual Studio: How to build only the StartUp project
Friday, October 10th, 2008Have 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.