Chapter 52. macros

WHAT'S IN THIS CHAPTER?

  • Understanding macros

  • Creating macros

  • Testing and debugging macros

  • Deploying macros

Like add-ins, macros are another common extensibility option built into Visual Studio. As discussed in Chapter 50, macros have many benefits over add-ins (quick to create, and Visual Studio actions can be recorded to a macro), but also many downsides (they must be written in VB, can't be compiled, and have limited abilities). It's a tradeoff as to which means you use to automate Visual Studio based upon your requirements. If you perform the same set of actions repetitively in Visual Studio, macros are a great way to reduce these down to a single action.

This chapter takes you through the process of recording a macro and running it again, creating macros from scratch, and deploying macros to other developers once you've created them.

UNDERSTANDING MACROS

A Visual Studio macro (it's actually called VSMacro but is commonly known just as a macro among developers) is code that can be run by the Visual Studio IDE to automate a task. The code is not compiled, but is interpreted — it's essentially a scripting language for Visual Studio. A macro is implemented as a public method in a module that takes no parameters and does not return a value. Like add-ins, macros use the Development Tools Extensibility (DTE) API to automate the Visual Studio IDE. Macros can't display any user interface elements in Visual Studio (such as a tool window) — if you need this sort of functionality, ...

Get Professional Visual Studio® 2010 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.