Previous Entry Add to Memories Share
Converting from MVC2 to MVC3
johnhilts
There's already a lot of info addressing the conversion from MVC2 to MVC3.

This link has a pretty good run down of your options, succinctly presented:
http://drew-prog.blogspot.com/2011/01/how-to-deploy-aspnet-mvc-3-app-to-web.html

I personally had a problem that I wasn't finding any relevant hits for on Google - here're the details:

Compiler Error Message: CS0103: The name 'model' does not exist in the current context
 
The first line in my .cshtml file was:
 
@model System.Collections.Generic.List<ltmi.web.Models.AdminMemberCompleteFieldsModel>

The line was generated by VS.  To this point I thought I had completed the conversion, but this was my first actual attempt at using a Razor view in this application, and it turns out I still had one piece missing: I grabbed the web.config file from the Views folder of another "pure"  MVC3 app and just copied it over the web.config in the Views folder of my MVC3 app converted from MV2.  That fixed it.

I got the hint from here:
http://stackoverflow.com/questions/3516130/upgrade-mvc-2-to-mvc-3-issues-with-views (see answer by "Wiaan")

Now I get to use the clean Razor syntax and gradually replace web form views with Razor views.

Happy Coding!


You are viewing johnhilts