views:

130

answers:

1

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 '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?

+5  A: 

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.

Chris
I certainly don't know, but thanks all the same. :-) Fixed my problem...
Andrew Flanagan
+1 Because I like to know when I helped someone.
Chris
Well now it's two people at a bare minimum (and that's not even counting the other people on my team).
Tom