Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Aug 03, 2012 09:06 PM by Izhido
Aug 03, 2012 08:31 PM|LINK
I'm asking this because I've noticed that in MVC projects, several folders have special meanings ("Controllers", "Views"); when you right-click on them, or on the files they contain, you get access to special menu options, also related to MVC.
But if I attempt to make these folders on, say, one recently generated "ASP.NET Empty Web Application" from VS2010/2012, I don't get these options. It's like either 1)these folders are specially marked for being MVC folders, or 2)the project itself is, as
a whole, marked as a MVC project, so these folders gain automatically that particular meaning.
The thing is, no matter how many times I tried, I simply can't find any significative difference between the .csproj file of the Empty Web Application and the one from a MVC .csproj file.
What am I overlooking here? What makes them different, so much that Visual Studio *knows* that one is MVC and the other is *not* ?
Aug 03, 2012 08:48 PM|LINK
These folders are just regular folders, but the project itself has to be marked as an MVC project. This is in the .csproj file, there's a GUID in there that indicates MVC vs not.
Also, just as an FYI, you don't have put controllers in the controller folder, they can be in any folder even a different project as long as the class name ends in Controller and it inherits from Controller or a derivative of that. The views folder on the
other hand is fixed and mvc expects it to be there because the default view engine expects it there.
Aug 03, 2012 09:06 PM|LINK
Aha! There it is, on the <ProjectTypeGuids> tag. Thanks a lot!