神刀安全网

Macros Return to Visual Studio

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 3 rd party alternative.  To address this shortcoming, Microsoft’s Justin Clareburt has announced the return of macros to both Visual Studio 2013 and 2013 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.

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » Macros Return to Visual Studio

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址