Tutorial :Format source code on save in Visual Studio 2005


I would like Visual Studio to format my source code every time I save. I can do this in Eclipse. Can it be done in Visual Studio 2005?


You can do it with a macro.

Here is the code for the macro, which can be mapped to a button in a toolbar and/or a keyboard shortcut

Public Module SaveAndFormat      Sub SaveAndFormat()          DTE.ExecuteCommand("Edit.FormatDocument")          DTE.ActiveDocument.Save()      End Sub  End Module  


It is possible with the Powercommands plugin for VS.NET, but, I fear that this plugin is only available for VS.NET 2008.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »