views:

295

answers:

4

I want to know if any tool exists for removing unused references (not unused using directives) within a .NET C# project.

A: 

http://stackoverflow.com/questions/81597/remove-unused-references-using-visual-studio

MIght have an answer for you :).

bastijn
He asked explicitly not how to remove unused `using` directives, but unused references.
dtb
aye crap, I read too quickly, answer will be deleted.
bastijn
+4  A: 

I am unaware of such a tool off the top of my head - I do know that Visual Studio does not include one by default. However, referenced assemblies that are not actually used by code in the project are automatically removed by the C# compiler from the list of assemblies referenced by the compiled program. If you use Reflector, you can compare the list of actual references to the list of references in the project, and remove the unnecessary ones that the project includes based on that.

280Z28
how can I use it in VS 2008? I cannot find it.
Cornel
.NET Reflector is a free (and essential) program from redgate: http://www.red-gate.com/products/reflector/
280Z28
Reflector is Redgate Reflector which can be found here: http://www.red-gate.com/products/reflector/
Murph
A: 

Resharper will certainly do the trick...

Cédric Rup
A: 

Resharper has that option.

Carra