Circular dependency detected

Topics: General
Feb 13, 2013 at 9:39 PM
Our team's solutions reference a large number of NuGet packages, and have frequently run into circular NuGet dependency issues which, up until now, we've been able to figure out. But now I'm finding myself stumped. Let me try and lay out the situation in generic terms.

We have a packages.config that (not including items listed before or after) includes this:

..., A, B, C, D, E, ...

In terms of dependencies, it looks like this:

A is dependent on B
B is dependent on C, D and E
C is dependent on D and E
D is dependent on E

This builds successfully. Now, I need to add package F, which is, like A, dependent upon B. So now the dependencies look like this:

A is dependent on B
F is dependent on B
B is dependent on C, D and E
C is dependent on D and E
D is dependent on E

No matter how I reorder these packages in package.config, I cannot escape the circular dependency error:
  • If I put it after A but before B (or immediately after B), the error output indicates that the circular dependency is A => B => F => B
  • If I put it before A, the output is F => B => A => B
  • If I put it after E, the output is A => B => C => E => D => F => B
Can someone help me with this? I can provide additional information if you need it.
Feb 14, 2013 at 7:58 AM
Edited Feb 14, 2013 at 8:01 AM
You are probably hitting this issue 2695


There is some discussion about it here: http://nuget.codeplex.com/discussions/352920
and a pull request to get a better error message here : http://nuget.codeplex.com/SourceControl/network/forks/broggeri/nuget/contribution/4012

Briefly put:
  • As you might have guessed, the error messages make no sense, don't believe them
  • It is likely that some of the dependencies involved is missing from your packages.config. [All direct and indirect dependencies should be listed in packages.config].