简体   繁体   中英

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:

  • An answer specific to ReSharper
  • Instructions on how to achieve this using ReSharper as I cannot seem to figure it out

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM