Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

auto format all files in solution in visual studio 2010

I'm trying to auto-format all files in my solution in vs2010. I've seen there is no built-in option to do it. I've tried to write macro to do it, but I've stucked.

When I iterates any ProjectItem in my projects, I don't know how to open designable-files in source-code mode, or how to distinguish between sourceable files and icourceable files (such as png-s or such).

Do you have any suggestions?

thanks.

like image 545
ayo Avatar asked Nov 11 '10 07:11

ayo


People also ask

How do I format all files in Visual Studio?

Usage. Click the context (or right-click) menu "Format All Files" on Solution Explorer, you can format all files. The progress is shown in the status bar.

How do I set Auto format in Visual Studio?

Auto formatting settings in Visual Studio Show activity on this post. Select the text you want to automatically indent. Click menu Edit → Advanced → *Format Selection, or press Ctrl + K , Ctrl + F . Format Selection applies the smart indenting rules for the language in which you are programming to the selected text.

How do I enable auto format in VS Code?

To automatically format the file on save, In Visual Studio Code, press Control + Shift + P or Command + Shift + P (Mac) to open the command palette and type setting and then select Preferences: Open User Settings option. Search for format on save setting and check the checkbox.


1 Answers

Well instead of writing a macro check out a Code Maid (free on visualstudiogallery) has these 2 features:

  • Cleanup a single file, all selected items or the entire solution
  • Cleanup option to run automatically on save

With a number of options for what CleanUp does

like image 86
Gern Blanston Avatar answered Oct 04 '22 00:10

Gern Blanston