Reputation: 834
Dependency Walker seems to be a good tool for finding module (DLL) dependencies. But what if I have all these "modules" in the same assembly, separated by namespace like below?
namespace Root.ModuleA { ... }
namespace Root.ModuleB { ... }
namespace Root.ModuleC { ... }
Does a tool exist that can find out namespace dependencies inside my assembly, e.g. that Root.ModuleC
uses stuff in Root.ModuleA
?
Upvotes: 2
Views: 2437
Reputation: 13842
To complete the tijmenvdk note, two default rules (over LINQ queries, CQLinq) are proposed concerning namespace dependency cycle:
You can try these rules on your code now, NDepend proposes a free time-limited full-featured trial edition. Then you can export dependencies between namespaces to a dependency graph or a dependency matrix (the matrix is better suited if you have dozens of namespaces):
The dependency graph could look like (notice the namespaces in red entangled in a cycles):
The dependency matrix could look like (notice the cycle highlighted with a red square)
To go further you can read these two whitebooks on partitioning .NET code through assemblies and namespaces. Also recently Hendry Luk wrote a complete blog post about getting rid of namespaces dependency cycles in its project SheepAop.
Disclaimer: I am one of the developers of the tool
Upvotes: 2
Reputation: 15579
Visual Studio's Architecture Explorer does a pretty good job of that. There is a dependency graph specific to namesspaces.
Upvotes: 2