VS Macro Magic How To

This post has been republished via RSS; it originally appeared at: Channel 9.

DRY, Don't Repeat Yourself.

As Dev's, we hear that all the time about our code. But what about when using our coding environment?

Why do the same thing, over and over, click, nav, click, copy, click, click, click...?

Don't think there's any other option? Well luckily there is!

Back in May we highlighted the new Visual Studio Marco extension, VS Macros are back!

This month we're going to highlight a post from Iris Classon, where she shows us just how easy it is to use them....

Step by step Macros for Visual Studio

"I was asked for a simple example showing how to use/get started with the Macros for Visual Studio extension I mentioned a efw days ago on Twitter. Here is a simple ‘get-started’ I threw together today. I’ll expand this post later with a better example, as well as a video.

Some of the features:

  • Record and playback active document operations and Visual Studio IDE commands
  • Playback multiple times
  • Manage and persist macros with a Macro Explorer
  • Assign keyboard bindings to any macro
  • Macro editing in Visual Studio with DTE IntelliSense
  • Sample macros

Once installed the extension can be foun in the Tools menu, and there is also a window you can choose to add to your workspace (Macro explorer).

image

A macro I made for fun is one that converts camel case properties to Pascal case. This is very handy if you use the feature I discussed in the previous post and don’t have Resharper (the feature I’m talking about is the paste JSON as classes feature in Visual Studio). I’m sure somebody is going to tell me that this is already integrated in Visual Studio somehow

Step by step

..."

[Click through to see the steps and the results]