开发者

Error in ASP.NET MVC 2 View after Upgrading from ASP.NET 4.0 RC to RTM

In my View, I am trying to loop through a list in a LINQ object that as part of my View Model. This worked fine earlier today with the VS2010 RC and the .NET 4.0 RC.

<% if (Model.User.RoleList.Count > 0 ) { %>
    <% foreach (var role in Model.User.RoleList) { %>
       <%: role.Name %><br />
    <% } %>
<% } else { %>
       <em>None</em><br />
<% } %>

It used to happily spew out a list of the role names. No data or code has changed. Simply the software upgrades from RC to RTM.

The error I am getting is this:

\Views\Users\Details.aspx(67): error CS0012: The type 开发者_JS百科'System.Data.Linq.EntitySet`1' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

But System.Data.Linq IS referenced. I see it there in the references list. I tried deleting it and re-adding it but I get the same error.

Any ideas?


Fixed. I had to add

<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, publicKeyToken=b77a5c561934e089" />

To system.web / compilation / assemblies in the Web.config.

Why did it work before? The world may never know.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜