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.