Adding Razor support to existing ASP.Net MVC 3 project



Follow the below steps to add Razor support to existing ASP.Net MVC 3 project

  1. Create another Temporary project based on MVC 3 Razor support by default
  2. Compare the references, web.config (main one and one under views folder) in the Temporary project with my own project. Here I found references to System.Web.Helpers & System.Web.Webpages. Similar mentions exist in the web.config files also. Just copy those sections from the temporary project to your project.
  3. Copy the _ViewStart.cshtml file from temporary project to your project (under Views folder)
  4. Copy the _Layout.cshtml file from temporary project to your project (under Views\Shared folder)
  5. Also check inside _Layout.cshtml. It may be referencing other partial views, jquery (js file) etc. Make sure they all exist in your own project.
  6. That’s it. Compile and all should be set right.

Thanks :)



Leave a Reply

Your email address will not be published. Required fields are marked *