Sunday, May 22, 2011

MVC Visual Studio Helpers

If you mix Web Forms and MVC in the same project, Visual Studio helpers for MVC come in really handy when adding Controllers, Views, and so on. It is as easy as right-clicking the Controllers directory and the Add menu will display "Controller" at the top of the list. This is really convenient. Depending on the context, the destination of the right-click, different options will be displayed in the Add menu.

However, if you are modifying an existing Web Forms project to work with MVC, these options will not be available by default. The fix is simple.

In your existing Web Forms project's .csproj file, locate line


and add one more guid at the front, so that it looks like this:


Now all the options available at the MVC project will be available in the (previously) Web Forms Application project.


No comments: