joshcomley
joshcomley

Reputation: 28818

Is there a way to find all unused code in a .NET project using ReSharper?

I've just done a major, major overhaul on a colleagues project and throughout the process almost everything got rewritten. There was far too much code beforehand.

Now, I am left with the prospect that in amongst my project somewhere are old pre-refactoring methods that are no longer needed.

Is there a way to search the whole project for such methods in one go?

I understand the risk of potentially removing code used via reflection.

It's very similar to this question, except I would like two extra things:

Upvotes: 2

Views: 1423

Answers (2)

Pawel Lesnikowski
Pawel Lesnikowski

Reputation: 6381

Use solution-wide analysis.

If you change "Unused declaration" in "R# Options/Inspection Severity/Code Redundancies/Unused declaration" to "Show as Errors", you'll be able to identify all unused declarations.

Upvotes: 8

Levi Rosol
Levi Rosol

Reputation: 4418

As far as I know, there is not way to do this with R# for the entire solution/project. The only way I know of is to go through your code manually, pressing Alt+F7 on each method name.

Upvotes: 0

Related Questions