circular project references in .NET -- no way around?
Posted on 2010-08-29
So I am creating multiple projects in .NET, a VB.NET forms project, a class library, etc.
I add a reference from one to another, and then instantiate the second (B) from the first (A).
So A can call B's functions in its source code.
However I don't seem to be able to pass a reference to A from A to B, so that B can call A's functions. This is because I can't add a reference for A to the B project, I get an error along the lines of "this would cause a circular reference."
So in order for B to call A, I have to create a .NET event in B, and raise the event and trap it in A.
Is it true that I can't have two projects call each other's methods directly? I have to raise an event one way since it can't have knowledge of the other's functions, since a reference is not allowed?
Or is there a different way to achieve this?
p.s. the reason this seems odd is that two .NET classes within the same project can reference each other. I'd think they'd have built the capability between projects as well....