Macromacner is a Visual Studio extension package that allows you to create your own macros for the Visual Studio IDE. Instead of creating a new full package for simple tasks you can use this tool to easily implement the additional functionality that you need. Macro projects are .NET assemblies and can be implemented in C# or VB.NET. This gives a great advantage to the programmer as he can benefit from all the features that the Visual Studio offers, such as intellisence, debugging and much more. Hence macros can be very simple and contain a few lines of code or they can be massive and include other dll assemblies as well. If you are familiar with .NET then creating macros will be a very easy task for you after getting familiar with Macromancer and Visual Studio API. MacrosThe macros that you will create will be placed to the Macromancer window tree and optionally to the Visual Studio Menu and Toolbar. Macro classThe following is the template of the macro class that should be implemented in order for a new macro to be created. /// <summary> /// Give your macro a meaningful name and summary description /// </summary> public class MyMacro : Macro { /// <summary> /// This is the macro's main method. It is called when the user /// clicks/double clicks on the corresponding item at the Macromancer tree view or /// at the Macromancer menu and/or toolbar. Implement this in order to provide the /// extra functionality that you need. /// </summary> /// <param name="dte"> /// See MSDN documentation of how to use this /// https://msdn.microsoft.com/en-us/library/envdte80.dte2.aspx /// </param> /// <param name="Output"> /// Use this in order to print anything to the Macromancer output window /// e.g. output("Hello world"); /// The output window can be accessed from Visual Studio /// View->Output (Ctrl + Alt + 0). Select the Macromancer window from the combo box /// </param> public override void Run(DTE2 dte, Action<string> output) { } /// <summary> /// A unique identifier for this macro /// </summary> public override string GetGuid() { return "8632b4be-3d34-4816-a53c-3518d191c844"; } /// <summary> /// Implement this to provide a name for your macro. /// The name is appeared at the Macromancer tree view and /// the Macromancer menu and/or toolbar. If you delete this method /// from your macro class a default name will be provided. /// </summary> public override string GetName() { return base.GetName(); } /// <summary> /// Implement this to provide a description for your macro. /// The description is appeared as an item tooltip to the Macromancer tree view. /// If you delete this method from your macro class there will be an empty tooltip. /// </summary> public override string GetDescription() { return base.GetDescription(); } /// <summary> /// Implement this to provide an image for your macro. /// The image is appeared at the Macromancer tree view and /// at the Macromancer toolbar. /// If you delete this method from your macro class a default image will be provided. /// </summary> public override Uri GetImageUri() { return base.GetImageUri(); } /// <summary> /// By default the macros will be added only at the Macromancer tree view. /// Implement this in order to add your macro at the Macromancer menu and/or toolbar /// </summary> /// <example>return Owner.TreeView | Owner.Menu | Owner.Toolbar</example> /// <remarks> /// Mind that in order for a macro to be added in the toolbar /// you need to provide a valid image i.e GetImageUri() should be /// overridden and return a not null value /// </remarks> public override Owner GetOwner() { return base.GetOwner(); } /// <summary> /// By default the macros will be added at the Macromancer tree view, /// menu and toolbar under the category with the same name as your project's /// assembly name. Implement this in order to add extra layers of categories. /// e.g. return "Build" /// </summary> /// <remarks> /// If you need to add subcategories use the "|" operator like /// return "Build|Debug" /// </remarks> public override string GetCategory() { return base.GetCategory(); } |