I created 2 dummy projects in my application and named them BAL
and DAL
. When I build them, they build successfully. If I add a reference to
It is implicit in the concept of "layers" that higher layers depend on lower ones, and not the other way round. If 2 "layers" are mutually dependent, then one is not higher than the other, they are not layers in any meaningful sense, and so can be considered to be in the same layer. The same basic principle holds for architectural components or modules, as enforced by Studio for project dependencies. If you use this principle - think of your projects as design modules rather than e.g. just throwing everything into a single project - you will have well-structured codebase which will give you far less problems as it grows in size.
In my case I copied a project file without generating a new ProjectGuid
. Since Visual Studio uniquely identifies projects using the ProjectGuid
, it assumed the project was trying to reference itself.
You can only reference in one way otherwise you get the error like you said. Just do this: delete the reference from your DAL to your BL and make a new one from your BL to your DAL!
Occasionally, you have two different projects, each of which needs methods that the other has. In this case, you can either make a third project and move the shared code into there, or choose one of the two projects to put the shared code in.
To get around this, add the reference by browsing to the projects DLL after it has been built. Do not select it from the "Projects" tab.
That would cause a circular dependency. What you perhaps want to do instead is have a main application project, which references the BAL, and then BAL referenes DAL. Data access should not need to reference business logic.