205

Apparently macros were dropped from Visual Studio 2012.

Is there a plugin/extension/tool that will let me record & play keyboard macros (much like the record/play temporary macro in Visual Studio 2010)?

For example, I typically would use a macro when converting code from one language to another or to quickly generate properties from a text list, etc.

7

10 Answers 10

184
+100

You can try the Text Macros for Visual Studio 2012-2022 extension (I am the author). It basically does the same thing as the Notepad++ macros (text editing, no UI automation).

The code is open source (GitHub), so feel free to contribute improvements :-)

13
  • 21
    +1 God bless you. Just a few minutes ago I was horrified to discover VS2012's omission of macros, and you posted this 11 hours before I got here!
    – Shaul Behr
    Nov 13, 2012 at 11:11
  • 3
    Xavier, I've just installed your extension, and one thing that is missing is support for capturing find operations (such as F3 to find the next instance of text). This is very useful for operating on text which you can't get to using just the standard cursor moves. Is there any chance of adding this?
    – pxb
    Nov 15, 2012 at 14:50
  • 2
    @pxb good point, I never though of using these but I can see them being useful. I have created an issue and will definitely look into it. Nov 15, 2012 at 23:05
  • Awesome! Thank you so much. I was dying without macro support.
    – Sam Woods
    Dec 29, 2012 at 0:38
  • I love it! It's so much nicer than the slow macro implementation in VS2010! Jul 15, 2013 at 9:13
161

In this version of Visual Studio, while there are literally hundreds of features, there are some we’ve actually taken out. One of those is the macros automation feature, including macro record/replay, macro projects and the Macros IDE. While we know that macros have been valuable for those who use them, unfortunately our usage data shows that less than 1% of Visual Studio developers take advantage of this feature. Therefore, we’ve found ourselves investing more deeply in the Visual Studio areas that get used every day, and have not updated macros for several releases.

Source: Macros in Visual Studio 11 Developer Preview

I have started to get around this (although inconvenient) by cutting/pasting into Notepad++, record and run the macro there and then cut/paste it back into Visual Studio 2012.

26
  • 193
    Cutting code out of your world class IDE to paste into Notepad++ to record and play a simple macro is a clear Microsoft Fail. However, I concur that this is the currently the simplest solution to this. Sad, but true.
    – mattmc3
    Sep 4, 2012 at 17:38
  • 73
    Less than 1% is definitely madeup, every (VS/C#) developer I know have used macros, I agree not everyday. Sep 26, 2012 at 20:36
  • 13
    Another reason to stick with VS2010 - or beg for it to be brought back here visualstudio.uservoice.com/forums/121579-visual-studio/… Oct 3, 2012 at 8:08
  • 15
    This is unbelievable...1%??? This can't be true! This feature needs to be added back in - I used macros constantly in 2010.
    – Rockdocta
    Nov 19, 2012 at 16:21
  • 44
    @SanjeevakumarHiremath I agree the number sounds low (not sure it's made up), but this is an argument in favor of always checking that box when you install a Microsoft product that says "send anonymous usage statistics to help better MS products."
    – Michael
    Jan 22, 2013 at 4:05
50

Stand out and vote for bringing macros back!

http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2650757-bring-back-macros

UPDATE (10/4/2013):

Yay! Thank to your votes the macros are now considered for return! Keep pushing!

We are currently reviewing the feasibility of delivering a scripting capability in a future version of Visual Studio. Please continue to offer your comments on what scripting capability we should offer while we research this suggestion.

Tony Goodhew, Program Manager, VS Pro.

1
  • 1
    Voted +3. Though, I did the same for Bluetooth SPP support in WP7 (which was the #1 requested feature), and it took them over two years to implement a limited version of SPP. :(
    – eduncan911
    Mar 19, 2013 at 18:56
25

Since using Sublime Text I found that there are in fact better ways to edit text than by using macros.

Sublime allows you to to edit your text with multiple cursors at once. It's hard to explain but there are several animations that show it off at http://www.sublimetext.com

Sublime Screenshot

I've also added Sublime as an external tool to Visual Studio:

  • open Tools/External Tools
  • add: Sublime, select the exe and use these arguments: $(ItemPath):$(CurLine):$(CurCol)
  • (also move it to the top as this makes the next step easier, otherwise remember its position)
  • then go to customize/Keyboard, search for Tools.ExternalCommand1 and add your preferred keyboard shortcut.

This will open the current document in Sublime at the same cursor position that you were in VS.

(also, Sublime can do macros in case you still need them)

2
  • 3
    Here is a great extension for VS2012+ that adds this type of editing, it has been very useful to me: visualstudiogallery.msdn.microsoft.com/…
    – Duane
    Jun 4, 2014 at 16:21
  • 2
    That said, there are times when macros are handy, like having to perform the same action in multiple files.
    – Duane
    Jun 4, 2014 at 16:22
23

MACROS ARE BACK!

Under Review → Completed

We’ve heard your feedback loud and clear, and we’ve been working on a solution. We’re therefore very happy to announce that we’ve now released a version of Macros that supports both Visual Studio 2015 and Visual Studio 2013.

While we were at it, we took the opportunity to fix a couple of bugs and improved the keyboard shortcuts. We hope you enjoy it.

For more information, see the blog post here: http://aka.ms/vsmacros

We’ve also open-sourced the code under the MIT license. If you have any suggestions or contributions, feel free to create an issue or a pull request in the new GitHub repo: http://github.com/Microsoft/VS-Macros

Justin Clareburt Senior Program Manager

Macros for Visual Studio

Macros for Visual Studio is an extension for Visual Studio 2013 and Visual Studio 2015 that enables the use of macros to automate repetitive tasks in the IDE. The extension can record most of the commands in Visual Studio including text editing operations. 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
  • Macros recorded as JavaScript files that call VS DTE APIs
  • Macro editing in Visual Studio with DTE IntelliSense
  • Stop playback
  • Sample macros

enter image description here

2
  • This plugin is very buggy. I got it working on VS2017 eventually, but it stopped working a couple of hours later. Reviews are largely negative.
    – StuartN
    Oct 27, 2017 at 8:56
  • Please note that while the source code is open source, "This extension was originally created by a group of interns on the Visual Studio team. It is no longer maintained"
    – Yann Duran
    Mar 29, 2019 at 8:00
18

Visual Commander extension (developed by me) supports code editing macro recording and playback in Visual Studio 2015/2017/2019.

3
  • This extension is superb! It's GreaseMonkey for Visual Studio! I made good work with it (made WebEssentials compile all the LESS files in my project), and also wrecked some havoc to the project too! Thank you very much for this excellent piece of software. Nov 5, 2014 at 14:58
  • I did try it with VS2015 and it dont records REPLACE actions :'( Aug 20, 2015 at 15:33
  • It's been working great for me since 2017.
    – EvilTeach
    yesterday
5

I just was brought to my attention that Microsoft released an extension to Visual Studio 2013 to support macro's back again:

https://visualstudiogallery.msdn.microsoft.com/d3fbf133-e51b-41a2-b86f-9560a96ff62b

I'd advice to still vote for the feature to encourage them to make the extension available for Visual studio 2015 too: https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2650757-bring-back-macros

1
  • This sounded pretty good, but the CTRL-M,P keys are bound to "stop outlining". Even after removing this binding, the default playback doesn't seem to work.
    – Wheezil
    Nov 16, 2015 at 0:10
3

Use Macros for Visual Studio 2013 + 2015

Macros open source URL: https://github.com/Microsoft/VS-Macros

Announcement on MSDN Blog: Macros extension: VS 2015 support and open-sourced

2

VSScript allows recording, writing, and editing macros in Lua, though I have not yet been able to make it work with Visual Studio 2015 (the command button is greyed out; documentation says Visual Studio 2005 to 2015 RC are supported).

It is currently released as a freeware.

2

The Visual Commander extension lets you automate repetitive tasks in Visual Studio.

Not the answer you're looking for? Browse other questions tagged or ask your own question.