4

Does anyone know of a tool to remove redundant using statements from classes, or a whole solution?

I'm using the Refactor! addin which has a "move type to separate file" smart tag, but it takes all the using clauses from the original class with it.

1
  • I blame the Chrome spellchecker for my misspelling Commented Jul 30, 2009 at 12:31

4 Answers 4

12

VisualStudio 2008 does this out of the box.

Simply right click in the code window -> Organise Usings -> Remove Unused Usings.

You can set up a shortcut key to do this, as explained here.

Sign up to request clarification or add additional context in comments.

Comments

10

Resharper does this pretty well.

Comments

9

PowerCommands for Visual Studio upgrades the default VS.NET 2008 functionality of "Remove Usings" to an entire project or solution.

I use it all the time. It also has a lot of other useful features- check it out.

Best of all it is FREE.

5 Comments

+1 great tip. I've had PowerCommands installed for quite some time, but I never noticed that before.
@Joe- I've only recently noticed some of the other things it adds like "extract constant". Probably the most useful though is open containing folder- that's a real obvious feature that Visual Studio should have anyway.
My favourite PowerCommands feature is Collapse Projects - we work with huge solutions. BTW Open Containing Folder is a feature in VS 2010 :-)
I've got PowerCommands but didn't notice it there, or Joe's answer
@Joe- that's useful to know. Collapse projects is a real sanity saver with big solutions.
4

ReSharper does this.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.