views:

187

answers:

2

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

+1  A: 

On the off chance try changing your bindingRedirect to

<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
BuildStarted
This didn't help but I agree that a brand new mvc 3 project does use this instead of the double dependentAssembly entries for 1.0 to 2.0 and 2.0 to 3.0
Phil Strong
Yeah, I guess I would have never known it was a bug...it was the only real difference between my config and yours that might have been pertinent.
BuildStarted
+4  A: 

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.

Brad Wilson
So this seems like it's making it a non usable preview. It also appears as if perhaps for the same reason intellisense is no longer intact in the view.
Phil Strong
@Phil, the preview should still be usable for your scenario with the workaround that Brad suggested. Apologies for the inconvenience!
Eilon
So moving it to the bottom did fix some of my pages but others were having buffer cannot be null exceptions being thrown in System.IO.MemoryStream ..... case in point it's not ready for even development IMHO. I have over a hundred views and controls and that would be a nightmare to move the directive line to the bottom even if it was 100% reliable
Phil Strong
Was this bug resolved in the Beta 1 version?
Kiranu
Yes, this was fixed for Beta.
Brad Wilson