Remove And Sort Using

Free

Adds a context menu entry to Solution Explorer that sorts and removes using statements on every file in the solution, project, or on the individual file.

(27) Review
Visual Studio
2010
Download (10,074)
8/3/2010
1.4
E-mail Twitter del.icio.us Digg Facebook
Add to favorites
Description
Reviews (27)
Q and A (9)
Sign in to write a review
Sort by:

by Luís Rudge | November 08 2013

This is awesome, but its crashing with typescript files, saying that remove and sort is not available for this type of file (or something like that, sorry)

by Deepak Naidu | March 27 2013

by mrul.mrul | March 04 2013

Bravo. Many thanks.

by AlwaysMC2 | October 18 2012

by Chu Đình Hoan | August 30 2012

Add Hotkey Please

Ctrl+Shift+I like Netbeans IDE

by Guillaume A. Cantin | July 31 2012

Works great for my project. Reorganized my 200+ files solution's usings in a minute or so

by ForeverZer0 | July 15 2012

Worked great for me on a solution with 9 projects, no errors.
This is a great tool and compliments VS nicely.
Thanks for sharing.

by Sonic3R | June 13 2012

In ASP.NET MVC3, if I select multiple Controller files (by holding CTRL and click on each file) and select `Remove and Sort Using` then the exception is thrown: OBJECT REFERENCE NOT SET TO AN INSTANCE OF AN OBJECT.

But 5 stars for saving my time...

by AmeenEt | June 09 2012

Saves me several valuable minutes every day :)

by DevGuy_ | April 18 2012

Ran this on a Solution level. In hindsight, probably not a good idea just in case there were any problems encountered.

It removed my using statements for System.Linq even though in code I was using:

IEnumerable<T>.First() and IEnumerable<T>.FirstOrDefault()

I ended up with hundreds of errors. The easy fix was adding back using System.Linq;

by David Hamdan | March 02 2012

I just downloaded and tried this plugin for VS2010 SP1. At the project level, it only seems to work on files that are "visible". I.e. I had to expand all folder nodes within a project for this to work.

by Mazhar A Shaikh | January 17 2012

Hi,
I am glad that this does exactly as specified in the description (like a charm).

Few Suggestions:
1) Can we add functionality in the extension to exclude Designer.cs files when run at a project level. This is because we better not touch the designer files. I tried running it on a project and ended up with a few unexpected errors related to the designer.cs files.
2) If we want just a few files to be sorted, by holding the Ctrl key and selecting multiple files and then running the extension. It prompts a "Object variable not set exception."
3)Also can we add a shortcut key to perform the same action.

Thanks for developing such a brilliant piece of code. Appreciate it.

Maz

by mdsharpe | December 16 2011

Doesn't do anything when I try and use it.

by Aidiakapi | November 12 2011

Your plugins are underrated!

It's nice to finally be able to clean up all documents easily.

1) Format documents
2) Remove and sort usings
3) Collapse everything

Thanks for that :)

by Odai Kurd | July 28 2011

by Rollo1002 | June 10 2011

Ran into some initial issues (User Error) by not saving the project as a solution. Once I did, the plugin worked flawlessly. Nice Plugin.

by 柳永法 | May 29 2011

Remove And Sort Using and Format Document have Same problem:
Sometimes does not work

this is a Update Reference and rewrite your program


http://visualstudiogallery.msdn.microsoft.com/a7f75c34-82b4-4357-9c66-c18e32b9393e

by Praveen Modi | May 20 2011

Super awesome! Thanks so much.

by S Tonstad | October 06 2010

Doesn't work. When I do it for a solution it runs through about three files and then it stops. I then tried at the project level and it does not do anything. 1 star for being completely broken.

by CraigNicholson | August 25 2010

The extension is a great idea but needs some more work.

1. You should be able to select a sub-folder in a project and be able to execute the plugin.

2. The plugin should be aware of source controlled files. I've got my SCC provider (Vault) set keep my files read-only and to auto-checkout. The plugin throws an "Object instance not set to an instance of an object." error dialog when attempting to execute against checked-in (read-only) files.

1 - 20 of 27 Items   
Sign in to start a discussion


  • Any plan of supporting VS2012?
    2 Posts | Last post April 18, 2013
    • This would be a nice feature to have on 2012. Thanks!
    • Owen, 
      
      Thanks for the interest but this extension probably won't be updated. Productivity Power Tools offers this feature and many more.
      
      We (Mike and I) originally created this extension because Power Commands 2008 wasn't updated for Visual Studio 2010 at launch. We decided to create extensions for the features we liked/needed/missed/ the most. 
        
      You can get Productivity Power Tools here:
         http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef
      
      It's basically several extension packaged as one. You can disable the ones you don't wont.
      
      Thanks.
  • Smart Remove And Sort Using
    1 Posts | Last post June 11, 2012
    • It would be nice if it was possible to create a list of not-removable namespace (i.e. System, and System.Linq).
  • Ignore generated files
    1 Posts | Last post January 24, 2012
    • Would it be possible for this extension not to process files which are generated? In other words ignore those which are dependent upon a file with the custom tool set to 'TextTemplatingFileGenerator'.
      
      As currently it makes a bit of mess of source control constantly having namespaces being added/removed every time the code is generated or the extension is run.
  • Some limitations
    2 Posts | Last post November 23, 2011
    • Thank you for this excellent visual studio extension! :)
      
      I noticed there are a few limitations:
      1. does not support System.Linq namespace.  So even if I use a Select() or Single() method on a collection, the "using System.Linq;" will still get removed.
      2. does not support custom extension methods.  For example, if I use an extension method that is in another namespace, it will remove "using MyApplication.Helpers.Extensions;"
      3. does not support collapsed nested .cs file.  For example, in a silverlight application, .cs files are nested in .xaml files.  if the .xaml file is not expanded and I attempt to perform a "Remove and Sort Using (this project)", the hidden nested .cs file will not get touched.
      
      I am wondering if this is the best place to report issues, etc.
      I am wondering if this extension can be put on codeplex for example?
      
      Thank you.
    • Rami,
      
      Thanks for the feedback. I'll look at getting the code push out to Codeplex. 
      
      As for the shortcomings, the extension is exposing shortcomings in Visual Studio. This extension automates a built in Visual Studio command against multiple files - one file at a time. I don't have any plans on improving upon the built in VS command. Sorry if our extension causes you any problems. 
      
      Thanks again for the feedback, it is appreciated.
      
      - Cory
  • Must Save Project as a Solution to Work
    1 Posts | Last post June 10, 2011
    • One thing I did come across is that you have to save the project you're working on as a solution to get it to work properly. This might be stated somewhere but was not evident and I don't always save my projects as solutions especially websites.
      
      Once I saved the project to a solution it worked flawlessly. Nice Plugin...
  • S Tonstad
    1 Posts | Last post October 06, 2010
    • If you can provide some details on the solution structure (project types, nesting structure, etc) then I maybe be able to reproduce the problem (and fix it).
      
      Very few people have reported any problems with this extension or any another that I have published. When given the right information I can usually fix the bugs. 
  • aspx.cs files
    3 Posts | Last post August 03, 2010
    • I just tried using this tool on a rather large web project and although it worked great on all the .cs files it did not remove the usings in the aspx.cs files.  Is there an option I have not set to have it do this too?
    • Never mind.  Something stopped my first pass after doing a folder of only .cs files.  Second time around it hit all the .as?x.cs files too.  and .designer.cs files. 
    • Thanks Kurt. 
      I had a similar experience - first pass didn't catch every file but the second attempt worked.
      I updated the code to look at every project regardless of type.  It seems to be more consistent now.
      The latest version is 1.4. If you have any issues please let me know. 
      
      Thanks,
      
      Cory
      
  • VB Imports?
    2 Posts | Last post June 01, 2010
    • Does this support the Imports statements in VB, or only the usings in C#? 
      Given you say it 'executes the "Remove And Sort" command' I'm guessing it does not support VB; can you confirm?
    • "Imports" statements are not supported. 
      
      This extension automates a Visual Studio feature which doesn't work for VB import statements.
      
      If the Visual Studio team decides to add support for VB then I will update the extension to take advantage of it. Currently, the extension will skip all non-C# projects.
      
      Thanks Eidolon.
  • This doesn't do anything
    4 Posts | Last post May 31, 2010
    • Nope. Not a thing.
    • Sure it does. It opens each code file within each C# project and executes the "Remove And Sort" command.
      
      Essential, it will remove any unused "using" statements. Additionally, it will sort the using statements alphabetically.
      
      It's designed to keep the solution tree in the same collapsed/expanded state after it runs. So solution explorer should look the same before and after it runs. Also, there won't be any files left open either. If a file was open before you ran the command it will remain open.
      
      
    • Just the plugin I was after, works great!
    • Thanks, Kevin!