Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET find dead code across multiple solutions

We have a product with ~15 solutions with each a number of projects.

The question is quite simple: Which tool will enable us to search the entire codebase for dead code?

Searching within a single solution is easy enough (Lots of answers on SO for that one).

But what about determining if "public void Foo()" in project AlphaProj of solution AlphaSol ,which is not used within AlphaSol itself, is actually used in e.g. BetaSol ?

like image 905
Thomas Avatar asked May 25 '11 08:05

Thomas


2 Answers

Although you have 15 solutions nothing stops you from creating another solution that will have all the projects referenced, let's say All.sln. So whenever you need to find external references you open this All.sln solution and look for the references.

We probably have about 100 solutions, and one All.sln that references all the projects from those solutions. It is easy to add all the projects from one solution to All.sln: you just select Add Existing Projects and select one of those 15 solution files. You need adjust file type in Add Existing Projects dialog to be able to select solution file. Also, to keep this big solution organized, you can use solution folders.

like image 138
Alex Aza Avatar answered Nov 03 '22 23:11

Alex Aza


You might also want to checkout NDepend.

Since the other answer is quiet sufficient for your immediate need, and I don't want to sound like a bad commercial, I leave it to the interested reader to find out more about that tool.

like image 25
Christian.K Avatar answered Nov 04 '22 00:11

Christian.K