Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrade MVC 2 to MVC 3 issues with views

I'm attempting to upgrade my existing ASP.net MVC 2 web application to MVC 3 so I can use the goodness that is the Razor Viewengine and other said improvements.

After using the converter to convert my app from mvc2 to mvc3 I'm having issues with my strongly typed views. As an example here we have a view user control that is strongly typed to the class Profile

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Profile>" %>

During compilation I'm getting

Compiler Error Message: CS1061: 'object' does not contain a definition for 'folio' and no extension method 'folio' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)

which corresponds to this line in my view alt text

So it's like the views are no longer accepting a type. This is happening w/ user controls as well as full on views.

I've checked both web.config and views/web.config and both seem to be referencing System.Web.Mvc version 3.0.0.0

Any help would be appreciated!

See below for screen captures of web.configs

alt text

alt text

alt text

like image 465
Phil Strong Avatar asked Dec 05 '22 01:12

Phil Strong


1 Answers

This is a bug in MVC 3 Preview 1, and will be addressed in the next release. In the interim, you can rearrange your pages so that the <%@ Control %> directive is the last one in the file and that should the issue for you.

like image 112
Brad Wilson Avatar answered Feb 12 '23 23:02

Brad Wilson