This is a mirror of official site: http://jasper-net.blogspot.com/

The Small Things: Converting a Existing Web Application to a MVC Web Application

| Thursday, November 25, 2010
I have an existing web application that contains a couple of WCF services, but today I also wanted to add some pages and decided that I wanted to create them with ASP.NET MVC2. This is the steps I took to get the MVC pages to run just fine in my existing application.

  1. First of all I added references to System.Web.Mvc and System.Web.Routing
  2. I created a dummy MVC project so that I could see what was missing in my existing project.
  3. Then I created the convention based folder structure. Except for the minimum required folders of Controllers and Views, I also added Scripts, Content and Model folders.
  4. I copied all the java script files from the dummy project to my Scripts folder.
  5. I added a Global.asax file to my project and copied the content from Global.asax in the dummy project, but of course corrected the default route.
  6. I opened up the dummy project file in Notepad, and the same with my existing project file. In the project files I looked for the <ProjectTypeGuids> and compared them. For ASP.NET MVC2 the {F85E285D-A4E0-4152-9332-AB1D724D3325} GUID was missing so I changed from:
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
to:
<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>

Please note that the exact GUID will be different for ASP.NET MVC3 (I assume this anyway).

Read more: Eric's Blog

Posted via email from .NET Info

0 comments: