0

I have one solution. I have 2 Dll's (projects):

The UI dll:

  1. excecutes the solution
  2. activates a continues operation in class on"B" dll that will return an array at the end.
  3. activates some functions on Business-Logic dll.

The "B" dll:

  1. is doing a continues operation.
  2. While doing continues operation- it fires some events to the printing class in the UI dll.
  3. At the end of the operation it returns an array to the UI dll.

It appear that I need to Add references in both UI and "B" dll's in order to use each other's classes and functions.

Problem: Visual-Studio gives me error " Adding this project as a reference could cause circular dependency".

Camilo Terevinto
  • 31,141
  • 6
  • 88
  • 120
Uri Gross
  • 484
  • 1
  • 8
  • 20
  • 1
    Design errors often lead to circular dependencies, which should be avoided whenever possible. Make sure to never call the UI directly from your Business DLL. – Fabian Bigler Oct 26 '18 at 22:50
  • You can re-desing your packaging. You need a client dll and a server dll. The server dll need not to know anything about the client. The server dll is called by the client and could return data to the client in the form of arrays or any type of object. So, you can have 1 solution project with 2 subprojects in vs in this way. – NoChance Oct 26 '18 at 23:53

1 Answers1

0

The problem is not the error itself, you have a design problem, you can check out this material:

What is Circular Dependency and How Do We Resolve It?

And this question over here

Thales Raymond
  • 336
  • 2
  • 9
  • I know that I have a design problem. But I don't know how to solve it. I need to use in "UI" function located on "B" dll. But on the other side I need to use a function "B" dll that is located on "UI" dll. But as I understand I can only add one reference of dll to another and not at the same time back. – Uri Gross Oct 26 '18 at 23:17