Question: How can I relocate my MVC6 folders to another folder and still have them work

Question

How can I relocate my MVC6 folders to another folder and still have them work

Answers 1
Added at 2017-01-02 01:01
Tags
Question

I'm using MVC6, and I can't figure out how to relocate these folders in my project:

  • MyWebApp
    • Controllers
    • ViewModels
    • Views

Into a common folder like this:

  • MyWebApp
    • Mvc
      • Controllers
      • ViewModels
      • Views

Physically relocating the files and folders is easy enough, but MVC can't find the files anymore:

InvalidOperationException: The view 'Index' was not found. The following locations were searched:

/Views/App/Index.cshtml 
/Views/Shared/Index.cshtml

How do I add the /Mvc folder as a location to look for MVC related goodness?

Answers
nr: #1 dodano: 2017-01-02 01:01

What you are looking for is called 'areas'. Check out this link MVC 6 Areas

Source Show
◀ Wstecz