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 BAL
to the DAL
project, it added nicely. But while adding the DAL
reference to the BAL
project, I get the following error:
A reference to DAL could not be added. Adding this project as a reference would cause a circular dependency.
Can anyone help me to solve this error?
In my case I copied a project file without generating a new
ProjectGuid
. Since Visual Studio uniquely identifies projects using theProjectGuid
, it assumed the project was trying to reference itself.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.