Update MVC 2 to MVC 3 viewing problems

I am trying to upgrade an existing ASP.net MVC 2 web application to MVC 3 so that I can use kindness, which is Razor Viewengine and others said improvements.

After using the converter to convert my application from mvc2 to mvc3, I am having problems with my highly typed views. As an example, we have a user control that is strongly typed for the Profile class

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

During compilation, I get

 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 matches this line in my opinion alt text

Thus, he, like representations, no longer accepts a type. This happens with custom controls as well as a full view.

I checked both web.config and /web.config views, and both seem to reference System.Web.Mvc version 3.0.0.0

Any help would be appreciated!

Below are screenshots of web.configs.

alt text

alt text

alt text

+4
source share
5 answers

This is a bug in MVC 3 Preview 1 and will be discussed in a future version. In the meantime, you can arrange your pages so that the <% @ Control%> directive is the last in the file, and this should be a problem for you.

+7
source

I just replaced web.config in my Views folder (with one of the recently created mvc3 project) as the proposed migration, and it worked for me. I was not ready to move all the ads to the bottom, because my project was too big.

Hope this helps, although it is probably too late for you. Maybe this helps others ...

+5
source

If bindingRedirect try changing bindingRedirect to

 <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" /> 
+4
source

I had the same problem and, pulling my hair a little, found and followed Wiaan's solution. It worked perfectly and the site returned.

It's funny that such a change in our dev blogs did not violate our site - it was only when we moved it to the intermediate server on which it appeared.

0
source

If your project is based on MVC4 or is already using Framwork 4, create an empty mvc4 project. And then replace web.config in the views folder. He works immediately. Thanks, Wianne. Since I have an old application that uses aspx, not a razor. After I upgraded Framework 3 to 4, I got this error.

0
source

All Articles