Format the class file and arrange fields, properties and methods as per StyleCop rules.
Members of the class are arranged in following order
Furthermore the members are also sorted by access modifiers as follows
How to use
After installation can execute format code command from two different place.
In Option 3 and 4, all the .cs file present within the Project or solution respectively will get formatted automatically.
Settings for tool can be accessed from Visual Studio options screen as shown below.
You can customize the layout of the class or interface by setting required layout under Type layout setting
Note: That the first time when this extension is installed, type layout will be blank. Hence first time user will have to configure the type layout, and you can also set type layout with the help of the default templates.
You can also choose to include class header by updating setting under File Header.
You can customize the file header format and you can use the available replacement to format the header.
You can also have the different file header template based on the solution or project also.
To have customized file header for a perticular solution, go to Solution and right click and go to "Code Formatter >> Add Header Setting File". And you can set perticular format in that setting file.
Same is applicable of project level file header as well.
Note: File template selection will first check for project header setting file, if not found then it will look for solution header setting file and if the file is not present then global header will be applied.
Download this extension from the VS Gallery
1. If you are installing it manually using VSIX file then make sure you uninstall the previous version anf then install the new version. Because if at the same time multiple version are installed of the same extension then extension will be disabled by Visual Studio.
2. It is advisable to install the extension from Tools > Extensions and Update option.