views:

101

answers:

1

Help. I installed VS.NET 2010 and now my existing ASP.NET MVC application won't run. I checked that the 1.0 version of System.Web.Mvc is still referenced but when I browse my application, I get an error like this: "Compiler Error Message: CS1579: foreach statement cannot operate on variables of type 'object' because 'object' does not contain a public definition for 'GetEnumerator'".

My partial view has this declaration:


<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<List<ProductModel>>" %>
//various import statements

<div>
    <% 
        foreach (var category in Model.Categories)
        { %>       
            <span><%= category.Name %></span>
            <span><%= category.Market%></span>
     <% } %>
</div>

For what it's worth, the source view shows ViewUserControl in red and gives a tool tip reading "Cannot resolve symbol 'ViewUserControl'".

My working code didn't change, the only delta is that I upgraded to VS.NET 2010 (which includes MVC 2.0); I'm sure something is not referenced correctly but I cannot figure out what's going on.

A: 

Remove the assembly name from the pageBaseType attribute in Web.config in the Views folder.

SLaks
Thanks! I also changed version back to 1.0.0.0
Keith