Search structure of controller mvc 5

1

I have a normal mvc 5 application and would like to change the basic folder convention for controllers / views.

For example:

  • / Controllers / Admin /Controller1.cs
  • / Controllers / Admin /Controller2.cs

And when I create views, I follow the existing convention:

  • /Views/Controller1/Index.cshtml
  • /Views/Controller2/Index.cshtml

The problem is this: in action, when I use the "Go To View" option, it correctly finds the view, but winter does not work. In the view, when I use the "Go To Controller " option I get the message " Unable to find a matching controller ".

I can not consider the use of areas because the next version of mvc will come without it.

Is there a solution to this?

    
asked by anonymous 15.09.2015 / 19:55

1 answer

0

No.

Visual Studio assumes that all your Controllers are in the default design structure, that is, just below the Controllers directory.

There is no way to change this behavior, because Views does not refer directly to Controllers . What Visual Studio does is look at the directory these Views are in and deduce which Controller from them.

Note that using the shortcut in ~/Views/Shared/Layout.cshtml , you will get the same message. And this is correct, because Layout files do not belong to Controller .

    
15.09.2015 / 20:48