0

Using the code found here, I have managed to get a list of controllers in my mvc site (and can do whatever I want with that list) but I need to also get a list of views for each controller. Is there a way to do this?

Edit: To clarify, I'm looking to do this at run-time in order to get the views dynamically.

Community
  • 1
  • 1
user4593252
  • 3,496
  • 6
  • 29
  • 55

1 Answers1

0

you can use Roslyn to build a tool that will analyze your syntax for return View() statements.

but if you you use one function called ReturnViewByCondition(condition), Roslyn will consider it as a single result.

I see also the way to calculate Views file count in Controller folder, but it significantly depend on your ViewEngine implementation.

So, in most generic way, I would say "no", you can not have this statistics without siginifcant efforts in static analysis automation

Vladmir
  • 1,255
  • 9
  • 13