19

We had the Power Commands for Visual Studio 2008 that add a context menu command that Removed Unused Usings and Sorted Usings for all files in a project/solution.

How to do the same in VS2010 since this plugin is incompatible?

Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254
Jader Dias
  • 88,211
  • 155
  • 421
  • 625
  • possible duplicate of [Is there anyway to remove unused namespaces across a whole project or solution at once](http://stackoverflow.com/questions/283471/is-there-anyway-to-remove-unused-namespaces-across-a-whole-project-or-solution-a) – nawfal Feb 25 '13 at 09:06
  • possible duplicate of [Project wide "Remove and Sort Usings"](http://stackoverflow.com/questions/1107100/project-wide-remove-and-sort-usings) – Larry Mar 15 '13 at 19:27

4 Answers4

27

For Visual Studio 2012 just download the "PowerCommands for Visual Studio" extension from the VS gallery to execute "Remove and Sort Usings" for a project or solution:

http://visualstudiogallery.msdn.microsoft.com/e5f41ad9-4edc-4912-bca3-91147db95b99?SRC=Featured

10

For Visual Studio 2010 you can download the "Remove and Sort Using"extension from the Visual Studio Gallery.

http://visualstudiogallery.msdn.microsoft.com/en-us/cb559aa8-d976-4cc2-9754-5a712f985d16

CoryC
  • 660
  • 6
  • 6
  • Works, but only at the project level, not for the whole solution at once. Also had problems if a project contained sub-folders (AKA doesn't seem to traverse the folder hierarchy). – JohnB Nov 21 '10 at 00:44
  • Almost useless for me as our projects are always organised in sub-folders! – Rich Jan 13 '11 at 11:18
  • 4
    The extension has been updated several times and works with nested folders. – CoryC Apr 06 '11 at 19:27
  • I believe the link is now https://marketplace.visualstudio.com/items?itemName=CoryCissell.RemoveAndSortUsing – Hoppe Mar 29 '19 at 20:48
4

For Visual Studio 2013, the Productivity Power Tools provides this functionality, at least on a file basis, by right-clicking within a file and selecting Organize Usings -> Remove and Sort

Al Lelopath
  • 6,448
  • 13
  • 82
  • 139
  • The download on the gallery site didn't work for me (wrong version of VS) but if you search for Productivity Power Tools in the Extensions and Updates panel in Visual Studio 2013 it works perfectly. – Mark Watts Mar 31 '15 at 14:31
  • 1
    [Link for the VS 2013 version](https://visualstudiogallery.msdn.microsoft.com/dbcb8670-889e-4a54-a226-a48a15e4cace) – Mark Watts Mar 31 '15 at 14:40
2

You can download PowerCommands for Visual Studio 2008 source code and to port it (maybe isn't that hard), or take a look into ReSharper 4.5

Rubens Farias
  • 57,174
  • 8
  • 131
  • 162