To optimize namespace import directives using Code Cleanup
  1. Choose ReSharper | Options | Languages | C# | Namespace Imports (for C# settings) or ReSharper | Options | Languages | Visual Basic .NET | Namespace Imports (for VB.NET settings).
  2. Modify settings in these tabs as required to comply with your coding practices/standards.
  3. Choose Tools | Code Cleanup in the ReSharper Options dialog box.
  4. Create a new profile as described in Creating Custom Profiles. In the Selected profile settings for the new profile:
    • Select Optimize 'using' directives.
    • Optionally, select Embrace 'using' directives with region and specify the name of the region in the Region name field.
  5. Click OK to save the new profile and close the ReSharper Options dialog box.
  6. Open the Code Cleanup dialog box from the text editor or Solution Explorer as described in Running Code Cleanup.
  7. When the Code Cleanup dialog box opens, select the newly created profile in the Available Profiles area.
  8. Click Run to perform Code Cleanup. ReSharper will delete all redundant namespace import directives.
To reformat code with Code Cleanup
  1. Make sure that formatting settings configurable in the tabs listed above comply with your coding practices/standards.
  2. Open the Code Cleanup dialog box from the text editor or Solution Explorer as described in Running Code Cleanup.
  3. When the Code Cleanup dialog box opens, select Reformat Code in the Available Profiles area.
  4. Click Run to perform Code Cleanup. ReSharper will reformat code in your selection, file, directory, project, or solution (depending on how you chose to run Code Cleanup) according to your settings.
To remove code redundancies using Code Cleanup
  1. Choose ReSharper | Options | Tools | Code Cleanup.
  2. Create a new profile as described in Creating Custom Profiles. In the Selected profile settings for the new profile, select Remove code redundancies.
  3. Click OK to save the new profile and close the ReSharper Options dialog box.
  4. Open the Code Cleanup dialog box from the text editor or Solution Explorer as described in Running Code Cleanup.
  5. When the Code Cleanup dialog box opens, select the newly created profile in the Available Profiles area.
  6. Click Run to perform Code Cleanup. ReSharper will remove all redundancies that don't require interaction with the user.
To configure a file header and insert it into code files
  1. Choose ReSharper | Options | Languages | Common | File Header Text.
  2. In the File Header Text area, insert an arbitrary text that you want to insert into your code files.
  3. Optionally, to surround the file header with a region, enter the name of the region in the Embrace File Header into Region with Name field.
  4. Choose Tools | Code Cleanup in the ReSharper Options dialog box.
  5. Create a new profile as described in Creating Custom Profiles. In the Selected profile settings for the new profile, select Update file header.
  6. Click OK to save the new profile and close the ReSharper Options dialog box.
  7. Open the Code Cleanup dialog box from the text editor or Solution Explorer as described in Running Code Cleanup. Note that triggering Code Cleanup upon a selection prevents ReSharper from inserting the file header.
  8. When the Code Cleanup dialog box opens, select the newly created profile in the Available Profiles area.
  9. Click Run to perform Code Cleanup. ReSharper will update all affected files with the file header.