ReSharper Help

Code Cleanup

ReSharper | Tools | Cleanup Code

Code cleanup allows you to apply a number of ReSharper's code style features (see the table below) in a bulk mode to instantly eliminate code style violations in one or more files, a project or in the entire solution.

Code cleanup can have various configurations (profiles) to apply in different cases according to your needs. There are two default profiles that can be applied out-of-the-box:

If you want code cleanup to perform a different set of tasks, you can create custom cleanup profiles and specify the set of desired tasks there. You can also choose a default or a custom profile to be used for the silent cleanup.

Fixing inconsistent naming is not included in code cleanup because it can lead to naming conflicts. To learn how to deal with inconsistent naming, see Naming Style.

Most of ReSharper's code cleanup tasks are available in C# , some are available in several languages, others are language-specific. The table below lists all code cleanup tasks and languages/technologies where they are supported.

Code Cleanup Task C# VB.NET C++ HTML ASPX Razor JavaScript TypeScript CSS XML XAML RESX Build Scripts
Enforce 'var' keyword usage settings feature_availablefeature_available
Update file header feature_available
Remove code redundancies feature_available
Use auto-property, if possible feature_available
Make field read-only, if possible feature_available
Arrange qualifiers feature_available feature_available
Arrange modifiers feature_availablefeature_available
Fix built-in type references feature_available
Optimize 'using'/'import'/@Register directives / import statements feature_available feature_available feature_available feature_available feature_available
Reformat code feature_availablefeature_availablefeature_availablefeature_availablefeature_availablefeature_availablefeature_availablefeature_availablefeature_availablefeature_available
Reformat embedded XML doc comments feature_availablefeature_availablefeature_availablefeature_available
Apply file layout feature_available
Normalize quotes feature_availablefeature_availablefeature_available
Terminate statements feature_availablefeature_available
Optimize reference comments feature_available
Collapse empty tags feature_available
Alphabetize properties feature_available

See Also

Last modified: 21 September 2015