views:

216

answers:

7

Possible Duplicate:
Tools for finding unused references

I inherited a brownfield project and am in the process of refactoring the code to support new requirements. The number of assembly references has grown considerably over time, and I would like to know if any references are no longer being used. What is the best approach to this other than dropping the reference and trying to re-compile the code.

+1  A: 

I would suggest checking out NDepend. It gives you not only an idea for what assemblies reference other assemblies, but also a list of dependencies across them.

Joseph
Where is this in NDepdend? I've searched before, but don't see something that will tell you specifically whether a dependency on a specific assembly can be specified in CQL.
Reed Copsey
You have several choice to see asm not usedUse the Dependency Graph (see which box has no incoming arrow)Use the Dependency Matrix (see which row is empty)Use CQL: SELECT ASSEMBLIES WHERE AsmCa == 0this query will return assemblies with no user.Btw, having many assemblies is a bad thing:http://codebetter.com/blogs/patricksmacchia/archive/2008/12/08/advices-on-partitioning-code-through-net-assemblies.aspx
Patrick Smacchia - NDepend dev
A: 

Look at this question.

nasufara
A: 

Resharper suggests to add references if you used classes form dll that is not referenced, you can delete all references and add them back by resharper

ArsenMkrt
+2  A: 

You can do this with Resharper by JetBrains.

Just right click on a reference, and choose "Find Dependent Code". It will search the project and tell you exactly what is referencing an assembly.

Reed Copsey
A: 

Interesting enough, VB.NET projects do have an option that will do this, C# does not (that I have found). Resharper will allow you to right click on a reference and "Find Dependent Code".

NerdFury
A: 

So is there no free software to do this? Both Resharper and NDepend are paid apps. Though I guess you could use their trial versions(don't know if they are limited in functionality).

Eclipsed4utoo
A: 

Peli's Assembly Graph can show your assembly dependency graphs. It's a free add-in for .NET Reflector.

TrueWill