Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove unused Usings across entire assembly

Tags:

resharper

I am wondering if maybe ReSharper is able to run through every class and remove unused usings? I looked but I don't see an option like this in R# 4.5. Has anyone seen this in Resharper outside of just being able to remove usings in a single class?

like image 439
PositiveGuy Avatar asked Feb 25 '10 17:02

PositiveGuy


People also ask

How do I delete all unnecessary Usings in Visual Studio?

Go to Tools > Options > Text Editor > C# > Code Style > Formatting. It has an experimental Format Document Settings where you can have Visual Studio clean up your code. Two of the options are to "Remove unnecessary usings" and "Sort usings". Check these two and you're good to go!

How do I delete unused namespaces in Visual Studio 2022?

Navigate to Tools > Options > Text Editor > Code Cleanup. Add a check in the "Run Code Cleanup profile on Save." Be sure to select the appropriate profile you want to execute automatically whenever you save!

How do I delete a namespace in Visual Studio?

From Tools > Option, navigate to Keyboard tab. Search for “Edit. RemoveAndSort” which command will to both remove unused usings and sort the usings, then set shortcut for the same, as I did with “Ctrl + Shift + W” , Click on “Assign” and Ok. you are done.

How do I sort in Visual Studio?

How-to. Select Edit from the menu bar. Select Intellisense > Sort Usings. You can also configure different settings for using directives in Tools > Options > Text Editor > C# > Advanced.


1 Answers

Since Resharper 9, you can just select "in solution" scope when you clean up a using block.

enter image description here

like image 56
Kornél Regius Avatar answered Sep 18 '22 05:09

Kornél Regius