I am learning .NET MVC and an app I'm building has become rather spaghetti-like. In my code I have many actions in different controllers which naturally all produce various views and partialviews. To make matters worse, I have @Html.Action commands which add another layer of confusion. Some of this is left over from the default scaffolding action.
Is there any tool that produces a list of all the possible routes in my site and the views they return?
I'd also like to find all the unused views and actions without views and generally refactor everything properly. Something like this (please don't comment on this specific example):
Route Views returned
------------------------------------------
/User/Edit /User/Edit.cshtml
/Admin/User/Edit /User/Edit.cshtml
...
Does such a thing exist? Can it be done with a .tt template?
Or perhaps my whole approach is wrong..!
These maybe can help you on your way:
I haven't tested the Mvc Route Visualizer, but it seems like it could do what you ask.
Edit:
Maybe this works better for you. It won't show you the views returned, though, it will at least display all controllers and actions:
After routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
, add these lines of code:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
// If you don't have "HomeController", choose another controller you have.
// MvcCodeRouting will look for all controllers in the same namespace and sub-namespaces as the one specified here.
routes.MapCodeRoutes(typeof(HomeController), new CodeRoutingSettings
{
UseImplicitIdToken = true
});
// Other, existing, routes here...
Build and run the application.
If you have installed Route Debugger, you can see them there to: