Today while learning about Dependency Injection I found out a very neat way to view project dependencies with Resharper.
For the developers who aren’t familiar with Resharper it is an awesome Visual Studio extension that will help you code faster and it will suggest code improvements as well as tons of shortcuts, navigation features, code refactoring, code smells, etc, etc (I even met a Senior developer who wouldn’t help me with my code unless I installed Resharper on my machine)
Ok, back to the project dependency analysis !
Resharper can build a dependency graph based on the references found on each of your projects, this can be a huge advantage as your solution grows or if you’d like to have a bird’s eye view of the current state of the project and whether projects depend on (or have references to) projects that they shouldn’t.
The next project dependency graph was taken after following an Introduction to Dependency Injection (DI) using the Onion Architecture by Adam Stephensen
From the above we can see that there are no circular references in our solution and that there are not unintended references either.
Resharper will also let you visualize transitive dependencies or coupling between projects amongst other useful features.
To visualize your solution dependencies go to Resharper -> Architecture -> View Project Dependencies.
Using Visual Studio
Visual Studio (Premium or Ultimate editions) also bring dependency graphs to the table, the following is a dependency graph for a similar type of project (using the Onion Architecture)
For more comprehensive information about these architectural tools be sure to read Adam Stephensen’s blogpost as well as Channel’s 9 video on Understanding your code dependencies through visualization
What other tools do you use for identifying code dependencies?