I just wondered if it possible within various Visual Studio versions to automatically remove all references from a project that were never been used?
In your answer,
Using DevExpress, I follow these instructions:
For anybody coming here looking for Visual studio 2012:
Download and Install Reference Assistant for Visual Studio 11
Later you can do:
In a Visual Basic project there is support to remove "Unused References" (Project-->References-->Unused References). In C# there isn´t such a function.
The only way to do it in a C# project (without other tools) is to remove possible unused assemblies, compile the project and verify if any errors occur during compilation. If none errors occur you have removed a unused assembly. (See my post)
If you want to know which project (assembly) depends on other assemblies you can use NDepend.
Some people suggested to use an awesome tool - Reference Assistant for Visual Studio. The problem is that VS2012 is the latest supported Visual Studio. But there is the way to make it work in VS2013 as well ;)
And here is how:
1) Download Lardite.RefAssistant.11.0.vsix
2) Change the extension to zip: Lardite.RefAssistant.11.0.vsix
-> Lardite.RefAssistant.11.0.zip
3) Unzip and open the extension.vsixmanifest
file in the text editor
4) Find all occurences of InstallationTarget Version="[11.0,12.0)"
and replace them with InstallationTarget Version="[11.0,12.0]"
(note the closing bracket)
5) Save the file and zip all files so they are on the root zip level
6) Change the extension of the new zip
to vsix
7) Install and enjoy :)
I've tested it with VS2013, thanks source for the tutorial
EDIT Add to support VS 2015 Community Edition
<InstallationTarget Version="[14.0,15.0]" Id="Microsoft.VisualStudio.Community" />
Meaning of the brackets
[ – minimum version inclusive.
] – maximum version inclusive.
( – minimum version exclusive.
) – maximum version exclusive.
You can try the free VS2010 extension: Reference Assistant by Lardite group. It works perfectly for me. This tool helps to find unused references and allows you to choose which references should be removed.
You can use Reference Assistant extension from the Visual Studio extension gallery.
Used and works for Visual Studio 2010.