BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Macros Return to Visual Studio

| by Jeff Martin Follow 4 Followers on Jun 06, 2016. Estimated reading time: 1 minute |

Several years ago (Visual Studio 2010 era), Visual Studio included a very popular macro system built around the VBA Macro language.  Starting with VS2012, that functionality has been missing from Visual Studio leaving users to either do without or seek a 3rd party alternative.  To address this shortcoming, Microsoft’s Justin Clareburt has announced the return of macros to both Visual Studio 2013 and 2015 via a new extension called Macros for Visual Studio. 

The extension provides users with several abilities, including the option to record and replay active document operations and IDE commands.  Macros can be replayed multiple times, they can be assigned keyboard shortcuts, and the resulting macro files can be edited from within Visual Studio.  The extension also can make use of Visual Studio DTE APIs for greater manipulation of the IDE beyond just recording keystrokes.

This access to the DTE APIs provides a major source of power for this extension.  Sample scripts are provided that include demonstrations on how to programmatically adjust font sizes, set breakpoints, or modify all files in active solution among many others.

It should be noted that there are a few limitations in the current extension.  First and perhaps most serious, developers who may have VS2010-era macros still in their possession will find that they are not usable with this extension as the macros are now written in JavaScript.  Another limitation is that it cannot record user input given to dialog boxes from within Visual Studio.  Third, macros cannot call other macros.  Finally, macros do not have not have a concept of asynchronous events (such as the variable time it may take for a build to complete) and so attempting to script around such events may lead to undefined behavior.

The extension itself is written in C#, licensed under the MIT license, and available on GitHub for those who wish to examine how it works.  It is also available via the Visual Studio Gallery for immediate installation and use within your IDE.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Small mistake in article by Kyle Smith

...Visual Studio 2013 and 2013 via...
should be
...Visual Studio 2013 and 2015 via...

Re: Small mistake in article by Charles Humble

Thanks for highlighting this. Fixed.

Charles Humble
Head of editorial, InfoQ.com

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

2 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT