I’ve searched but does Visual Studio 2008 have a setting for C# where it will autoformat/beautify my code as I write it? There is a setting for VB.NET called “prettify”. I’ve also searched the archives already and found a macro to execute this on save and I know I can drag and drop it onto the toolbar but I want it to work without my doing ANYTHING for both ASPX and CS files.
Is this possible via built-in setting, modification, or available from an add on?
Thanks
Under Tools | Options, you can navigate to Text Editor | C# | Formatting and select all three checkboxes. This will cause your code to be auto formatted per the formatting options in C# | Formatting on those certain events: namely typing a semi-colon, typing a close stache, or pasting in code.
Note: In order for this to work, the code in the file must be able to compile without errors. Also, if you don’t have any formatting options specified, or left at their default values, you may not see any difference.