title: ASP.NET "Reference required to assembly" error
body: <p>I have an ASP.NET page <strong>A</strong> that uses a data layer assembly <strong>DAL</strong>. I reference the <strong>DAL</strong> assembly with a<br>
  <code>&lt;%@ Assembly Name="NGC.DAL" %&gt;</code> tag since there is no project to add the reference to. The assembly itself I copied to the pages' bin folder.</p>
  
  <p>The assembly DAL is a project that references <code>System</code> and <code>System.Data</code>.</p>
  
  <p>Now when A calls a method in DAL, the compiler gives the error </p>
  
  <p><strong>BC30652: Reference required to assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes' containing the type 'System.Data.IDbConnection'. Add one to your project.</strong></p>
  
  <p>I tried referencing the assembly <code>System.Data</code> with a <code>&lt;%@Import Namespace="System.Data" %&gt;</code> tag and I tried copying it to the bin folder and referencing it with a<br>
  <code>&lt;%@ Assembly Name="System.Data" %&gt;</code> tag, both in A directly. Nothing worked.</p>
  
  <p>Why would a project A that uses project B which uses project C require a reference to B <strong>and</strong> C rather than just B and why does the way above not work?</p>
  
  <p><a href="http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/6a31606f-baf1-4c64-9008-41e1219d437c/" rel="nofollow noreferrer">This</a> MSDN thread covers the problem but shows no solution that works.</p>
  
  <p>EDIT: As Robert Wagner suggested I added the reference to the web.config.
  Now I get another error message. <strong>BC30560: 'CommandBehavior' is ambiguous in the namespace 'System.Data'.</strong> which is odd because the one in the web.config is the only one I reference inside the page.</p>
  
  <p>Maybe it's worth mentioning that the <code>System.Data</code> referenced and used in the DAL assembly is from the compact framework. But since it's the only one I use, where does the ambiguity come from? </p>