I think one of the most overlooked aspects of Visual Studio is it's extensibility through visual basic for applications (VBA). This is a little discussion about some simple scripts that help me through the day with visual studio. The code is kind of horrible, since I'm really not a basic writer at all but bear with me here.
Measuring build times
Maybe you've read some of the articles out there timing builds with lot of projects in the solution? Visual studio doesn't seem to come with timing of these things out the box, but it does come with an easy way to subscribe to events. One of the events you can subscribe to is the start build and stop build. Aha, that turns out that we can easily do that and print the time elapsed. Hooking on to the events through the module EnvironmentEvents can be done like shown here.
Described in this file are some of the edit helpers that helps me in editing my source files. Some of the macros are:
- AddClass. Adding a new class to the project is a tedious task. This script automates the act of creating the files, inserting the boilerplate code and adding the files to the subversion repository.
- AlignEscapes. Fixing the backslashes in a multiple line macro can be tedious and I just hate when they don't. Well, it annoys me a little bit. This little macro just fixes this making it easier to unescape things so you can copy it elsewhere and test it.
- EditModifiedDocumentsInPerforce. This script just goes through all the modified documents and runs the shell command "p4 edit" on them.
- HideAllWindows. This is my favourite. Since I do some development on my laptop which have limited screen realestate often you just want to see the source code and nothing else. This little scripts hides everything except the main document window.
- InsertBodyTemplate. Pastes a boilerplate code template for a class.
- InsertHeaderTemplate. Pastes a boilerplate code template for a header file.
- ToggleComments. This script toggles C++ line oriented comments for the current selection.
That's all for this time. Hope this gets you to start automating your day to day task of writing source code and you got some hints here for how to continue on your own.