0

I have a very large Windows Forms application that I am working on cleaning up. I would like to see if there is a way in Visual Studio 2017 Enterprise to find any forms that are not referenced in the code. I would rather not have to go through each one to see how many times a form is referenced.

I have already run the Code Analyzer and did not find any. Is that sufficient or should I do something else?

Michelle
  • 103
  • 1
  • 3
  • 7
  • 1
    Possible duplicate of [Get List of Zero Reference Codes in Visual Studio](https://stackoverflow.com/questions/30974433/get-list-of-zero-reference-codes-in-visual-studio) – Broots Waymb Jul 09 '19 at 15:09
  • Keep in mind that while the compiler can tell you if something is directly referenced, if you're using reflection it's not going to find that, because reflection happens at runtime. So you have to be careful when deleting code. I would do the Find All References, but I'd also check wherever reflection may be used, and I may do a string search across the entire project. You still can't be entirely confident, but that should get you most of the way there. That's where having automated regression testing can come in handy: you're more likely to discover any runtime issues you may cause. – mason Jul 09 '19 at 15:09

0 Answers0