locked
a reference to '' could not be added. Adding this project as a reference would cause a circular dependency RRS feed

  • Question

  • hey every1

    i am following the tutorial on http://msdn.microsoft.com/en-us/library/ms734795.aspx 

    Excercise 1 was no problem, and when i get to excercise 2, Task 3 i get stuck

    i cant add the StateMachineWorkflow project to StateMachineHost as a reference. . . when i try to do this i get an error:

    a reference to 'StateMachineWorkflow' could not be added. Adding this project as a reference would cause a circular dependency

    can any1 please explain what is causing this error and how can i reference the classes in StateMachineWorkflow because they are in different assemblies

    Thanks :(
    Thursday, February 11, 2010 2:31 PM

Answers

  • Does StateMachineWorkflow reference StateMachineHost?  The problem is that if each assembly references the other, which do you compile first because each one needs the other compiled to compile the other.  Thus a circular dependency would be formed if you added that reference.
    • Marked as answer by Angemon Friday, February 12, 2010 8:24 AM
    Thursday, February 11, 2010 2:40 PM

All replies

  • Does StateMachineWorkflow reference StateMachineHost?  The problem is that if each assembly references the other, which do you compile first because each one needs the other compiled to compile the other.  Thus a circular dependency would be formed if you added that reference.
    • Marked as answer by Angemon Friday, February 12, 2010 8:24 AM
    Thursday, February 11, 2010 2:40 PM
  • Thanks a lot :) u r officially my favourite person for this month

    it took me the whole day trying to figure it out and YES i did reference StateMachineHost in StateMachineWorkflow project, why and how i did that im not sure :)

    thanks for the quick response n simple explaination :) :) :) :)
    Friday, February 12, 2010 7:11 AM
  • I am in the same problem with add reference project. Then I change to add dll file of that project instead, and it works.

    Hope this help

    Emily.

    Wednesday, September 14, 2011 3:29 AM
  • In a single project the circular reference error does not exist, however because we generate two separate dll's the circular reference represents a problem.

    The parent project depends on the child project, therefore you may want to consider a mini dependency injection, by moving some logic into the child project as a new small class which can be injected into the parent object.

    Other options include combining the projects, so you have a single dll. Redesign so that layers better reflect dependency. Use of interfaces or events.

    Wednesday, July 3, 2013 1:58 PM