ReSharper Web Help

ReSharper can apply Code Cleanup to an arbitrarily selected block of code, all code in the current file, all files in a directory, the current project, or even the current solution.

To apply Code Cleanup to the current file
  1. Open a C#, VB.NET or XML code file in the text editor, make a selection to apply Code Cleanup to, or, alternatively, don't select anything, in which case ReSharper will clean up the entire file.
  2. Do one of the following:
    • Choose ReSharper | Tools | Cleanup Code on the main menu.
    • Press Ctrl+Alt+F.
    • Right-click anywhere in the text editor (or right-click a selection) and choose Cleanup Code in the context menu.
    The Code Cleanup dialog box opens.
  3. In the Available Profiles area, select a profile to apply to your file or selection. You can glance through settings of a selected profile in the Selected Profile Details area. (If none of the suggested profiles suits you, click Edit Profiles to create a custom profile. See Creating Custom Profiles for specific guidelines.)
  4. Click Run.

You can clean up not only an individual code file, but also all code files in a directory, project or entire solution. To do that, you should run Code Cleanup from the Solution Explorer.

To apply Code Cleanup via Solution Explorer
  1. Select an item (file, directory, project, or solution) in the Solution Explorer.
  2. Do one of the following:
    • Choose ReSharper | Tools | Cleanup Code on the main menu.
    • Press Ctrl+Alt+F.
    • Right-click the selected Solution Explorer item and choose Cleanup Code in the context menu.
  3. Choose a cleanup profile as described above.
  4. Click Run.

You can launch Code Cleanup in silent mode - that is, without displaying the Code Cleanup dialog box. Since in this case you won't be able to choose a profile explicitly, you have to assign a default profile to use every time you run silent code cleanup.

To assign a profile for silent Code Cleanup
  1. Choose ReSharper | Options | Tools | Code Cleanup.
  2. In the Code Cleanup tab, select a profile in the Profile to use with silent cleanup drop-down list.
  3. Click OK.
To run Code Cleanup in silent mode
  1. Do one of the following:
    • To run silent code cleanup in a specific code file, open it in the text editor or select its item in the Solution Explorer.
    • To apply silent code cleanup to a set of files (directory, project, or solution), select the corresponding item in the Solution Explorer.
  2. Click Ctrl+Shift+Alt+F.

See Also

Procedures

Reference