If you are doing serious software development you probably have automated builds (via TeamBuild or some other tool) which build all the build configurations you have, run all your unit tests, run code analysis rules, run source analysis rules and more. While writing code you probably want to have all those extra tools and checks turned off because they will drag your productivity down. When you are about to check-in, however, you will need to make sure your solution builds without errors in different build configurations as well as run all tests to make sure you are not about to break one of the many different automated checks performed during a build. All those builds and checks are usually performed manually by the developer as he is no TeamBuild application. And let's face it - this is a tedious piece of work which takes much of your precious time which will be better spent elsewhere.

Well, no more! Don't worry, I'm not transforming you into TeamBuild :-). Instead I will offer a small macro which can mitigate some of the pre check-in pain. Here's how to do it:

1) First, open up your Macros IDE. The easiest way to do this is using the Alt+F11 keyboard shortcut. I love shortcuts!

2) Next you will need to add a new module to the "My Macros" project. Check this screen:

 blog2

3) Paste the following method inside your new module class

blog1

The first line switches the build configuration of your solution.

The second line builds the solution. The boolean parameter parameter indicates whether the macro should block until the build is complete.

The third line runs all tests in the solution.

Obviously you could easily expand this to build more configurations.

4) Now it is time to create a convenient toolbar button for that macro. To do it: right-click on the toolbar to customize it and drag the macro from the commands screen to the toolbar to create a new item.

Blog 5

5) You can customize the button icon and text:

blog4

6) And you can even assign a keyboard shortcut!

Blog3

Well that's it. Hopefully this will help someone out there :)

Happy coding!


About the Author

Vladimir Milev

Vladimir Milev is a developer manager.

Comments

Comments are disabled in preview mode.