I have an ASP.NET page A that uses a data layer assembly DAL. I reference the DAL assembly with a
<%@ Assembly Name="NGC.DAL" %>
tag since there is no project to add the reference to. The assembly itself I copied to the pages' bin folder.
The assembly DAL is a project that references System
and System.Data
.
Now when A calls a method in DAL, the compiler gives the error
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.
I tried referencing the assembly System.Data
with a <%@Import Namespace="System.Data" %>
tag and I tried copying it to the bin folder and referencing it with a
<%@ Assembly Name="System.Data" %>
tag, both in A directly. Nothing worked.
Why would a project A that uses project B which uses project C require a reference to B and C rather than just B and why does the way above not work?
This MSDN thread covers the problem but shows no solution that works.
EDIT: As Robert Wagner suggested I added the reference to the web.config. Now I get another error message. BC30560: 'CommandBehavior' is ambiguous in the namespace 'System.Data'. which is odd because the one in the web.config is the only one I reference inside the page.
Maybe it's worth mentioning that the System.Data
referenced and used in the DAL assembly is from the compact framwork. But since it's the only one I use, where does the ambiguity come from?