Rohit
Rohit

Reputation: 7629

Remove unused references (!= usings) in C# project without Resharper?

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#.

Upvotes: 14

Views: 6419

Answers (2)

Scott
Scott

Reputation: 119

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.

Upvotes: 1

Jehof
Jehof

Reputation: 35544

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.

Upvotes: 9

Related Questions