Sunday, October 5, 2008
Saturday, October 4, 2008
I just couldn't find a shortcut key for doing this automatically. (Except F5 which actually builds all selected projects from Configuration Manager).
On a large scale solution with tens of projects, only selecting the current project in which you currently code, and doing the right click thingie, it's a pain in the ... you know better. :)
Searching the net, couldn't find much info except this excellent post: http://www.chinhdo.com/20070920/top-11-visual-studio-2005-ide-tips-and-tricks-to-make-you-a-more-productive-developer/
This one gave me the idea of implementing a macro for doing this automatically.
Go to: Tools -> Macros -> Macro Explorer.
Right click MyMacros, add a new macro and go to edit mode:
Write these lines:
Option Strict Off
Option Explicit Off
Public Module RecordingModule
If (IsNothing(DTE.ActiveDocument)) Then
MsgBox("Open a document from project desired to start debug on first.", MsgBoxStyle.OkOnly, "No active document found.")
If (MsgBox("Start debugging on" + DTE.ActiveDocument.ProjectItem.ContainingProject.Name, MsgBoxStyle.YesNo, "Debug?") = MsgBoxResult.Yes) Then
I only wish Macros were in C# and not VB. :P
Save it, rename it, and go to: Tools-Options-Environment-Keyboard.
On "show commands containing" type the name of your macro until the one you've created appears.
Then, assign a shortcut for it, like CTRL ALT SHIFT F5 or whatever you want, and you've saved yourself enough time of right clicking a menu and choosing some second menu item (which sometimes turns out to be a mistaken click.) :)
Test it by opening a file from the desired project and hitting the keystrokes. You can improve the code, as you need.