Removing Unused References in Visual Studio 2010

The C# IDE lets you easily clean up your .cs files’ using sections by right-clicking in the editor and selecting “Remove and Sort Usings”. Unfortunately, there is no such command for removing unnecessary assembly references from a project.

Searching SO brought up some answers regarding free tools implementing this operation, and the Visual Studio Gallery website contains at least 3 VS Extensions that provide this functionality:

Judging from the reviews pages of each product, all of them seem to share the problem that sometimes they remove assemblies even though they are required for compilation.

(This problem may occur if code in assembly 1 calls assembly 2 which returns an object defined in assembly 3, but assembly 3 is not referenced by assembly 1.)

Reference Assistant has a preview of the remove operation (screenshot), but I am not sure about the other products.

What is your preferred tool for this operation?

3 thoughts on “Removing Unused References in Visual Studio 2010

  1. Pingback: Remove Unused References with Visual Studio 2013 | devioblog

  2. Pingback: Remove Unused References with Visual Studio 2017 | devioblog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.