I am in the process of upgrading to MVC4. I have followed the instructions at http://www.asp.net/whitepapers/mvc4-release-notes#_Toc303253806 but in my Razor views and layouts I have errors like
- 'System.Web.WebPages.Html.HtmlHelper' does not contain a definition for 'BeginRouteForm' and no extension method 'BeginRouteForm' accepting a first argument of type 'System.Web.WebPages.Html.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)
I also have errors like:
- "The name 'Viewbag' does not exist in the current context
When I hover over @Html I can see it is of type System.Web.WebPages.Html.HtmlHelper not System.Web.Mvc.HtmlHelper
Not really sure what other information is pertinent but this is where I am:
- I haven't updated class librarys etc.. in the sln to .net 4.5 yet.
- The project was created in VS2010, but I am doing the migration in VS2012
- The project opens and runs OK with VS2012, .Net 4.0, MVC 3
Any pointers appreciated.
Edit: All references and files in web.config upgraded to:
- System.Web.Mvc, Version=4.0.0.0
- System.Web.WebPages, Version=2.0.0.0
- System.Web.Helpers, Version=2.0.0.0
- System.Web.WebPages.Razor, Version=2.0.0.0
Edit(2): In my /views/web.config (or /views/shared/web.config if I try @Paul 's solution below) in the element, I have my own base type which inherits from System.Web.Mvc.WebViewPage , the references in the containing library have been updated to MVC4 and go to definition takes me to the MVC4 dll.
Has anything changed in this area on the new release? I couldn't see anything pertinent in the release notes.