Architecture Tools in ReSharper 8

Like many people with very large Visual Studio projects, we in the ReSharper team wanted to get an overview of the 300+ project dependencies for ReSharper itself. Unfortunately, VS Ultimate gave us a representation that was rather difficult to interpret:

ReSharper 8 solution in VS Ultimate Architecture View

What we ended up doing is building our own tool for viewing project dependencies as well as comparing architectural snapshots as the solution continues to change and evolve.

Here’s how it works. First of all, with your solution open, go to ReSharper|Architecture|Build Architecture Graph:

Architecture Explorer Menu Item

ReSharper then goes through your solution and, without compiling anything, presents a dependency diagram of all the projects in the solution:

ReSharper Project Dependency Diagram

The great thing about the way R# does it is the fact that layout is calculated automatically to present an optimal illustration of dependencies between elements. ReSharper builds the dependency graph, and if the Show Code Metrics option is on (it is on by default) then reference analysis happens asynchronously — ReSharper analyzes the whole solution and indicates the strength of coupling between projects. This all happens on the background thread, so you can continue editing code, navigating etc. while ReSharper does its work.

There are two arrows linking the projects: black arrows show project references wheras grey arrows show unused references that can be safely removed without breaking the build.

The architecture diagram gets rendered for the scope you’ve selected in Solution Explorer: if you select just a folder with several projects, only those projects will be included. However, there is always a way to fine-tune which projects are represented by checking the appropriate boxes:

Architecture explorer view check boxes

Ticking each of the boxes shows or hides the appropriate elements on the diagram. This allows us to instantly update the representation of connections between different subsystems as soon as they are checked or unchecked in the list on the left.

The toolbar shown above has several options for how information is presented on the graph. First of all, there are several ways of grouping information:

Architecture view grouping options

The above options are None (meaning no grouping is done), Solution folders for grouping by solution folder, and File structure for groupings based on actual directory structure and the projects’ position therein.

The following toolbar buttons are also available:

  • Collapse Graph and Expand Graph buttons let you collapse or expand an area where a grouping is used. A collapsed group looks simply like this:
    Architecture view collapsed group
    As an alternative, one can simply double-click the + or - button on the group to expand or collapse it.

  • The Show/Hide Code Metrics button lets you show and hide metrics associated with the code. These metrics show used and unused references (black and grey arrows respectively) and also show the number of references from one project to another:
    Architecture view with metrics

    You can also select the indicator, right-click it and use Show Usages… to find out where these referencing calls actually occur.

  • Show Transitive References shows not only direct references but actually all transit references, so in addition to showing A → B → C, it will also show A → C on the diagram. This can lead to a very rich, circuit-like representation:
    Architecture view with transitive references

  • Save Architecture Graph lets you save the graph to a file.

  • Show Diff shows you a difference between two architecture graphs. In fact, you can also invoke this function (even without having a solution open) from the top-level menu:
    Open saved graph and diff menu

The ability to save architecture graphs to a file allows the user to look at the difference between the architectural layout of the solution as it continues to evolve. The following illustrates the changes that have been made to a solution:

Architecure tools diff illustration

The above is an illustration of the evolution in one of ReSharper’s subsystems. Red boxes indicate parts that have been removed, whereas dark green ones indicate new parts that have been added. The same color scheme is also applied to references.

Lastly, keep in mind that project-level menus which can be invoked in Solution Explorer can be invoked on Architecture View nodes in the same manner:

As always, we hope that you find this feature useful — it is already in the latest EAP, so if you want to see it today, you know what to do. Keep in mind that this is a very fresh tool that we’ve built, and one that we’ll be sure to augment with additional architecture-related features in future releases.

This entry was posted in How-To's and tagged , , . Bookmark the permalink.

34 Responses to Architecture Tools in ReSharper 8

  1. Greg Sohl says:

    I guess we should just say “Thank you”! Looks great.

  2. John Garland says:

    Very nice – a quick observation (granted, this is early) – Azure Cloud projects don’t get picked up in this – if they are the current project scope, they are treated singularly, and if selected in the check diagram, they sit off to the side. True, there isn’t a “normal” reference as there is in “binary” projects, but it might be interesting to see if there’s a way to fit them as containers of some kind in this view, chaining through the roles they contain…

  3. Sean Kearon says:

    Awesome – I love it!

  4. Matt S. says:

    Wow! This is extremely cool. Thank you so much!

  5. David Gardiner says:

    Nice feature – looking forward to you fixing the OutOfMemoryException when I ran it on our solution (which is reasonably large).

    (yes, bugs submitted)


  6. Agile Hobo says:

    Wow! It’s cool.

    Please add exporting graph to images.

  7. Thomas Stocker says:

    That’s absolutly awesome

    But when I saw this, a new product idea popped into my mind. Restructuring project structures.

    There is an existing product that analyses the structure of an project and lets the user create a new better structure. It makes than a list of restructuring tasks to get to that new structure the resturucturing tasks are on the code level.

    So my idea is can the architectural view be also used as an refactoring tool? Meaning

    creating a new Box -> creating new Project or Namespace.
    Moving classes from one box to another moving the classes from one project/Namespace into another project/Namespace. (Ala drag and drop).

    This means that the boxes can be expanded with first level for example namespace hierarchy and further down to classes. Like zooming into the code like in restructure. This would be uber cool. I know that this won’t happen in Resharper 8 but I think this could be a good longterm idea.


  8. alex says:

    This is awesome, so nice for our 100 projects solution!

    The only problem I can’t see how to zoom or print?

  9. Nick Portelli says:

    This feature doesn’t need VS Ultimate does it?

  10. @Nick That’s right, VS Ultimate is not required: you can use it even with VS Professional.

  11. Thanks everyone for the joyful comments!

    @John Garland Feature request submitted. Please vote!

    @David Gardiner You’re talking about this exception, right?

  12. @Agile Hobo We’ll add exporting to images: please vote for this feature request.

    Zooming in/out is currently only available with the mouse wheel. Are you expecting this functionality to be available with a slider?

    Printing architecture graphs will be supported (you can vote for the feature request).

    @Thomas Stocker Sounds interesting! We’ll definitely be thinking in this direction. I’ve logged your feature request in ReSharper issue tracker: here it is

  13. Joe White says:

    Cool! But buggy. Is it worth writing up the bugs at this point, or is it still under heavy development and I can assume it’ll get more stable?

    (Right-clicking an arrow and selecting “Find Usages” has no effect whatsoever; scroll bars don’t work as expected, and any attempt to use them just scrolls you toward the left/top; scroll wheel worked at first, but after I unchecked a bunch of projects, the scroll wheel stopped having any effect, even though the font was still about a 2-point size and unreadable.)

    It’d also be great if I could hide all test projects at once — one click to uncheck any project that depends on NUnit.Framework.dll. But I’m not sure of the best way to do that without hard-coding a list of test frameworks.

  14. @Joe
    Thanks! Always great to know something is rated cool by you )
    It certainly makes sense to file feature requests. As to bugs, I’d recommend letting a couple more nightly builds to come out, and if things don’t get better, start bombarding us with bug reports.

    P.S. Just wondering, have the unit testing fixes you needed finally made it to EAP?

  15. Joe White says:

    @Jura, yes they have — parameterized NUnit tests are much better in I sent some feedback about one bug (might have been via “ReSharper misbehaves” rather than YouTrack) — extra crossed-out leaf nodes appear in the tree, sometimes not even parented to the test method they belong to — but so far it looks like that’s just cosmetic. The bugs I was running into (not all tests running, not all results showing in the tree) seem to be fixed, and I haven’t run into the problem with a class not getting added to the session. So far so good.

  16. Alex says:

    What if you don’t have a big-ass solution, but multiple solutions and they have references to compiled .dll already.

  17. Sebastian says:

    @Jura: Regarding the feature request of @Alex: you could use a similar UI like in this Silverlight demo here:
    (take a look at the controls in the top left area of the view)
    It’s similar to the way you can navigate in mapping services and very easy to implement with what you’ve got already!
    That way you don’t have to add more and more icons to some toolbar and people know what to do with these controls, already.

  18. @Sebastian Thanks for the tip!

  19. Valerij Petrulevich says:

    Now, that is a nicely implemented tool – another reason to upgrade to ReSharper8.

  20. Sean says:

    Just installed the trial version and this tool marks f# projects as “redundant” even if they are being used? (Sorry to mention this here, but I couldn’t find the bug page.)

  21. @Sean, could you please fill in a bug report here with a sample solution attached?
    Link is:


  22. Tristan says:

    What versions of Visual Studio are supported for this feature? I’m using VS 2008 Professional Edition, and I don’t see the Architecture option under my ReSharper menu.


  23. Dmitri Nesteruk says:

    @Tristan: this feature is only supported from Visual Studio 2010 onward.

  24. Tristan says:

    Thanks Dmitri…looks like I’ll need to upgrade!


  25. Joseph says:

    Is there a way to change background color of exported graph?

  26. Andreas says:

    This tool is somehow not working for me. I have a solution with three projects in it. The graph shows me the correct dependencies between those projects, but each project is just one node and I cannot expand the nodes. There are no buttons on those nodes themselves and the “expand graph” button on the left toolbar doesn’t do anything. Neither does it do anything in single project solutions. I always end up with just one node per project.
    I am using the tool with 2012.

    (Also after installing Resharper 8 my VS 2010 installation didn’t work anymore but crashed on startup, so I had to remove Resharper 8 from that installation.)

  27. Sam says:

    I also have this issue same as Andreas.

    I have no ‘Build Graph’ option under Resharper > Architecture. Just an option to see graph for project dependencies, but nothing else, no ability to drill down etc.

    Am I missing something, has the instructions changed?


  28. Dmitri Nesteruk says:

    @Joseph at the moment, unfortunately, there isn’t – ReSharper uses the color settings that are defined for other elements, so there is nothing in Fonts & Colors to tweak. If this is critical for you, please request this feature on our issue tracker.

    @Andreas @Sam actually, at the moment, ReSharper only highlights dependencies between projects, so you cannot drill down or “expand” a project. Rest assured, we are working on having class-level dependency diagrams too! Also, there is no ‘Build Graph’ option, the ‘View Project Dependencies’ is the item you want.

  29. Ronny Birkeli says:

    Would really like to be able to save the graph in a format that makes it possible to open it in yEd Graph Editor or simular tools.

  30. Maikel Klerks says:

    Hi guys,

    great tool!
    I have a question though. I use the dark skin in Visual Studio 2013 and now the background of the architecture view is also dark. Which doesn’t look very nice. Do you happen to know which window type the architecture view uses? I can’t seem to find it.


    • Dmitri Nesteruk says:

      I don’t think there’s a specific setting for the background of Arch View – it most likely uses the global UI color settings. Even if you found the right color switch, that would damage all the other window and might get the UI looking inconsistent.

  31. Bogdan Mart says:

    It’s using yFiles. It would be great to be able to export graph to yEd format, to further adjust if for printing.

Leave a Reply

Your email address will not be published. Required fields are marked *