Is there any way of removing unused references to assemblies, in a C# project, without the help of Resharper? The MSDN documentation does outline something for Visual Basic, but I couldn't find the same dialogs for C#.
Asked
Active
Viewed 6,302 times
14
-
Is your question about removing references to assembles that are not necessary or about removing using statements in each source file that are not necessary? – Martin Liversage Sep 22 '09 at 08:14
-
Removing unused references to assemblies, yes. – Rohit Sep 22 '09 at 08:14
2 Answers
9
There is no build in support in Visual Studio to find unused assembly references in a C# project.
A workaround is, to remove a possible unused assembly, compile the project and look if it compiles successfully. If it´s the case an unused assembly was removed. Otherwise the removed assembly was necessary and it should be added again.
To check what assemblies are used by other assemblies you can use NDepend.

Jehof
- 34,674
- 10
- 123
- 155
1
For individual .cs code files, VS 2008 has: Edit, IntelliSense, Organize Usings, Remove Unused Usings (Alt-E, Alt-I, Alt-O, Alt-R). I haven't spotted anything for Projects.

Scott
- 109
- 1
- 1