views:

200

answers:

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.

+4  A: 

ReSharper does this.

Mitch Wheat
+10  A: 

Resharper does this pretty well.

Philippe Leybaert
+10  A: 

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.

Winston Smith
+8  A: 

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.

RichardOD
+1 great tip. I've had PowerCommands installed for quite some time, but I never noticed that before.
Winston Smith
@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.
RichardOD
My favourite PowerCommands feature is Collapse Projects - we work with huge solutions. BTW Open Containing Folder is a feature in VS 2010 :-)
Winston Smith
I've got PowerCommands but didn't notice it there, or Joe's answer
Chris S
@Joe- that's useful to know. Collapse projects is a real sanity saver with big solutions.
RichardOD