ASP.NET 1.0 site error after upgrade to VS.NET 2010

Posted by Keith on Stack Overflow See other posts from Stack Overflow or by Keith
Published on 2010-04-13T13:08:57Z Indexed on 2010/04/13 13:13 UTC
Read the original article Hit count: 318

Filed under:

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.

© Stack Overflow or respective owner

Related posts about asp.net-mvc