title: ASP.NET MVC 2 + LINQ to SQL - CS0012 Compilation Error
body: <p>In my database schema each forum has a category and categories can have many forums. I'm trying to list categories and their respective forums with the following code: </p>
  
  <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage&lt;dynamic&gt;" %&gt;
  
  &lt;asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"&gt;
      Index
  &lt;/asp:Content&gt;
  
  &lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"&gt;
  
      &lt;h2&gt;Index&lt;/h2&gt;
      &lt;% foreach (GameSite.Models.Category category in (IEnumerable)ViewData["Categories"])
         { %&gt;
         &lt;%= category.Name %&gt;
         &lt;% foreach (GameSite.Models.Forum forum in (IEnumerable)category.Forums)
            { %&gt;
            &lt;%= forum.Name %&gt;
         &lt;% } %&gt;
      &lt;% } %&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>When this is run I get the following error:</p>
  
  <pre><code>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&lt;T0&gt;' 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:        { %&gt;
  Line 12:        &lt;%= category.Name %&gt;
  Line 13:        &lt;% foreach (GameSite.Models.Forum forum in (IEnumerable)category.Forums)
  Line 14:           { %&gt;
  Line 15:           &lt;%= forum.Name %&gt;
  </code></pre>
  
  <p>I can confirm that <code>System.Data.Linq</code> is being referenced in my project.</p>
  
  <p>Any ideas?</p>