En mi esquema de base de datos, cada foro tiene una categoría y las categorías pueden tener muchos foros. Estoy tratando de enumerar categorías y sus respectivos foros con el siguiente código:ASP.NET MVC 2 + LINQ a SQL - CS0012 Error de compilación
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Index
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Index</h2>
<% foreach (GameSite.Models.Category category in (IEnumerable)ViewData["Categories"])
{ %>
<%= category.Name %>
<% foreach (GameSite.Models.Forum forum in (IEnumerable)category.Forums)
{ %>
<%= forum.Name %>
<% } %>
<% } %>
</asp:Content>
Cuando esto se ejecuta me sale el siguiente error:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0012: The type 'System.Data.Linq.EntitySet`1<T0>' 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'.
Source Error:
Line 11: { %>
Line 12: <%= category.Name %>
Line 13: <% foreach (GameSite.Models.Forum forum in (IEnumerable)category.Forums)
Line 14: { %>
Line 15: <%= forum.Name %>
puedo confirmar que System.Data.Linq
se está haciendo referencia en mi proyecto.
¿Alguna idea?
¿Estás seguro de que te estás refiriendo a la versión 4.0 de System.Data.Linq en lugar de a la versión 3.5? ¿Revisaste el archivo web.config? –
Sí, me refiero a la versión 4.0. ¿Qué quieres que busque en el archivo web.config? No veo System.Data.Linq mencionado en ninguna parte. –