开发者

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

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开发者_StackOverflow社区 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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜