This is a mirror of official site: http://jasper-net.blogspot.com/

Creating and Using a Macro

| Thursday, December 2, 2010
Keyboard:  CTRL + SHIFT + R (record/stop recording); CTRL + SHIFT + P (run)
Menu:  Tools -> Macros -> Record Temporary Macro; Tools -> Macros -> Run Temporary Macro; Tools -> Macros -> Save Temporary Macro
Command:  Tools.RecordTemporaryMacro; Tools.RunTemporaryMacro; Tools.SaveTemporaryMacro

You can record macros to do just about anything in Visual Studio.  In this example, we will create a macro that adds a new class to our project.  First, create a new project.  For this example create a Console Application:

Now we are going to add a class to the project and give the class a name.  When we do this, we will record the actions into a temporary macro.  Press CTRL + SHIFT + R to begin recording our macro.  You will know you are recording if the status bar indicates it in the lower left-hand corner:

Add a new class (CTRL + SHIFT + A) called "Bubba.cs":

DANGER:  There are lots of little "gotchas" that you will run into doing macros.  One that took me  a little while to figure out while doing this example was leaving off the ".cs" at the end of the file name.  For some reason it  doesn't like that at all.  Keep an eye out for little things like that as you use this feature.

Read more: Visual Studio Tips and Tricks

Posted via email from .NET Info

0 comments: