Helixoft Blog

Peter Macej - lead developer of VSdocman - talks about Visual Studio tips and automation

Debugging a macro in VS

I've just played with one macro and wanted to debug it. I placed a breakpoint and ran the macro. Macro worked fine but it didn't stop on breakpoint. It took me some time to realize that you must explicitly enable debugging in Macros IDE:

  • In macros IDE, go to menu Debug and select Enable Debugging.

You can then debug your macro as any other code.

Assigning a Keyboard Shortcut to a Macro in VS

Last time I forgot to mention one important thing - how to assign a keyboard shortcut to your macro. Often you don't need any button for your macro, the shortcut is enough. Or you can have both. As I already wrote, macro is similar to any named command. So to assign a shortcut to it:

  1. Go to menu Tools - Options... and select Environment - Keyboard.

    Keyboard options in Visual Studio

Placing a Macro on VS .NET Toolbar or Menu

Well, not very accurate title. In fact, we cannot place a macro itself on the toolbar or menu. Instead we can create a button for it. But let's start from the beginning.

You have created your super macro which saves you a lot of work in Visual Studio .NET (see how to create macro). It works perfectly, you love it and you want to use it as often as possible. But locating it in Macro Explorer and double-clicking its (sometimes quite long) name isn't the best idea. What you obviously want is to have a button on VS .NET toolbar or an entry in main menu which runs your macro when clicked. And of course you want to add some nice icon to your button. Today I'll show you how. It is even possible to add your macros or commands to right-click context menu. But this is more difficult and I'll show you this next time.

How To Create and Run a Macro in Visual Studio .NET

Welcome to my new blog. Here I will share some of my tips and tricks about VS that I learned or other people have asked for.

I start with the basic lesson about macros. Macros are still undiscovered area for many VS users though creating a macro is a quite simple task. Some people don't have time to play with macros, some don't know what they can use macros for and some even don't know that there are any macros in Visual Studio. This post is for all those people.

 

Start generating your .NET documentation now!
DOWNLOAD
Free, fully functional trial