Running ASP.Net MVC3 Alongside ASP.Net WebForms in the Same Project
- by Sam Abraham
I previously blogged on running ASP.Net MVC in an ASP.Net WebForms project. My reference at the time was a freely-available PDF document by Scott Guthrie which covered the setup process in good detail.
As I am preparing references to share with our audience at my upcoming talk at the Deerfield Beach Coders Café on March 1st (http://www.fladotnet.com/Reg.aspx?EventID=514), I found a nice blog post by Scott Hanselman on running both ASP.Net 4.0 WebForms along with ASP.Net MVC 3.0 in the same project. You can access this article here.
Moreover, Scott later followed-up with a blog showing how to leverage NuGet to automate the setup of ASP.Net MVC3 in an existing ASP.Net WebForms project.
One frequent question that usually comes up when discussing this side-by-side setup is the loss of the convenient Visual Studio Solution Explorer context menu which enable us to easily create controllers and views with a few mouse clicks.
A good suggestion brought up in the comments section of Scott’s article presented a good work-around to this problem: Manually add the MVC Visual Studio Project Type GUID in your .sln solution file ({E53F8FEA-EAE0-44A6-8774-FFD645390401}) which then brings back the MVC-specific context menu functionality in solution explorer of the hybrid project. (Thank James Raden!)