Jared
Jared

Reputation: 6070

Discovering where a circular dependency is

I've got a project that I was attempting to do some refactoring in and I split out some windows forms controls into their own project inside of my solution. I'm now getting a circular dependency error when trying to setup the required references.

My question is. Does VS (or some other tool) have anything in it that will help discover where the issue lies? I thought I had refactored out the issue, but this is obviously not the case.

Upvotes: 2

Views: 245

Answers (2)

Justin Pihony
Justin Pihony

Reputation: 67105

Unless I am misreading this, VS is telling you where the circular dependency lies just by telling you that you cannot add a reference. The project you are trying to add a reference to will already be referenced in the project that you are coming from (I think I worded that right...if not, here is the example)

ie.

  • ProjectA holds a reference to ProjectB
  • ProjectB cannot hold a reference to ProjectA, so you get a circular dependency error

As to trying to find the exact place(s) where you use ProjectB in ProjectA, so that you could switch the reference. I would just remove the reference and compile...all references will now throw errors.

Upvotes: 2

Rob Hardy
Rob Hardy

Reputation: 1821

Visual Studio Profiler tool does this very well if you have VS >= Premium edition.

Upvotes: 0

Related Questions