Remove unused References
It would be great to have an option to remove all unused References from a project.
Similar to [Organize Usings] > [Remove and Sort].
In addition to removing unused references (to assemblies), I wish that the C# compiler would remove unused code/classes/methods from the final app or .exe file. If you use a large library in an app, but the app uses only a small portion of the library, the entire library is included in the final app anyway. I wish that the final compiled app/exe contained only the references and classes that are truly used in the app.
For example, it is a big maintenance hassle to manually remove 60 unused classes and retain the 5 classes that are actually used in a particular app.
Pavel Svarc commented
Visual studio does a great deal this is a feature that would save so much time.
This is needed. Too many of these suggestions are met with answers saying to download a plug-in. The problem with plug-ins is that they aren't always kept up-to-date from one VS version to another (just look at Code Contracts). And many companies are becoming even more paranoid about letting their employees download software from the Internet because of malware and legal concerns. A simple feature like this should just be "baked in".
I would like the same behaviour than "Importing namespaces" in a file which are in gray (Visual Studio 2017) if the namespace is not used.
So, the name of the Reference (dll) also in gray if it is not used.
If VS does this for usings, I think it's only natural they do this for references as well. The add-in you mention doesn't cover VS2013. Is there something for that?
Marcel Roma commented
The *Reference Assistant* Visual Studio 2010 add-in published on CodePlex already helps in removing unused references from C#, VB.NET or VC++/CLI projects. Have a look:
please improve reference assitants capatibilities