views:

920

answers:

2

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?

+3  A: 

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

Frederik Gheysels
It looks like it does not work with C++ code.
Sorin Sbarnea
+3  A: 

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
phsr
cool, I was just looking for this
Crash893