views:

380

answers:

6

Is there any tool out there that can identify name spaces in the Using statement that are not needed and eliminate them from the source?

+1  A: 

Resharper

aceinthehole
+3  A: 

Visual Studio 2008 does this, and I believe that Refactor Pro from DevExpress (as Consolidate Usings) has this as a refactoring.

Forgotten Semicolon
+1  A: 

The Visual Studio Power Pack will do it ofr the whole project at once. There's also a way to enable it in VS2005 via the registry.

Mark Cidade
+8  A: 

Resharper, Refactor Pro!, Visual Studio 2008 now does this.

In VS2008 if you right click in the text of the file and choose the option Organize usings then select one of the options. It will remove and or sort the using statements.

PowerCommands for Visual Studio also does this.

Brendan Enrick
thank you. I guess I have put off installing vs 2008 long enough.
MikeJ
this is great. thanks to everyone who took the time to help me out.
MikeJ
+1  A: 

Code Rush with Refactor Pro does this. There is a light weight version of this built into Visual Studio 2008 which should do it for you. Highlight the namespaces and then right click them, then click refactor, and there should be an option to remove or re-order the usings.

Charles Graham
+1  A: 

Visual Studio 2008 PowerCommands can do this for a file at a time, or for an entire solution at once.

Kyralessa