The graph area in the right part of the Architecture View provides graphical representation of the project dependencies in the current solution or in the opened dependency snapshot.
In this topic
- Links between projects
- Showing and hiding items
- Panning and zooming graph
- Rearranging items
- Grouping projects
- Analyzing project references
- Detecting possible architecture problems
- Exporting Graph to image
Right-click on projects in the graph to use the same set of ReSharper project-level commands (including code inspection, navigation, refactoring, and unit testing) as that available in the context menu of the solution nodes in the Solution Explorer.
Links between projects
When you get a dependency snapshot, ReSharper makes it in two steps:
- Build the dependency graph based on the project references. This step is done very quickly even in large solutions.
analysis to calculate
numbers of usages in the referencing project.
This step can take several minutes and it runs in the background.
The progress of the analysis is reflected by the status bar on top of the
The state of the coupling analysis, which is enabled by default, corresponds to the state of the Turn Coupling Analysis on/off button. The coupling analysis is a resource-intensive process and may affect performance on large solutions. If you experience any lags when working with the diagram, you can use this button to disable the coupling analysis, adjust the diagram as needed, and then enable the analysis again. The analysis algorithm first calculates the coupling of the displayed projects and then processes projects hidden from the view.
Links between projects in the graph can be displayed in the following ways:
|Black solid line||The coupling analysis is either in progress or disabled, so the number of usages for this reference is unknown.|
|Blue solid line of specific width||The coupling analysis is over for this reference and at least one usage exists in the referencing project. The line thickness represents how many times types of the referenced project are used in the referencing project. If you hover the mouse over a reference, this number appears in the tooltip.|
|Black dotted line||The coupling analysis is over for this reference and the reference is unused. You can right-click on it and choose to remove it.|
|Green dotted line||The two projects are linked through other referenced projects that are currently hidden from the view.|
|Green solid line||The reference is missing in the snapshot but it exists in the solution. Can only appear if the Show Diff button is on. For more information, see Comparing Dependency Snapshots.|
|Red solid line||The reference exists in the snapshot but is missing in the solution. Can only appear if the Show Diff button is on. For more information, see Comparing Dependency Snapshots.|
Showing and hiding items
You can show or hide specific solution items (projects, folders, solution folders) in the graph using check-boxes for the corresponding items in the left. There are also several ways to show/hide items right from the graph area:
- To select one or more items in the graph and hide others, right-click on them and choose Selection | Show only selected modules. To select multiple items, Ctrl-click them.
- To select two linked items, right-click on the link between them and choose Selection | Show only selected modules.
- You can select one or more items, right-click on them and choose Selection | Show only selected modules. To select multiple items, Ctrl-click them.
- To hide an item, you can select it in the graph and press Delete.
- Another way to concentrate on specific items is to display the dependent or referenced projects and hide all other items. To do so, select one or more items (projects or grouping items), right-click the selection and choose Show This/These and Dependent/Referenced. Note that these commands only hide the irrelevant items and do not add any referenced/dependent nodes, which are currently not selected.
- To display all items referenced by or dependent on the specific projects, even if these items are currently hidden from the view, select one or more items and choose Selection | Add referenced/dependent modules.
If necessary, you can reverse changes made in the graph (shown/hidden projects) step by step. by clicking Undo or pressing Ctrl+Z. To reverse the Undo commands, click Redo or press Ctrl+Y.
Panning and zooming graph
To pan and zoom the graph, use the controls in the upper left corner of the graph area. Alternatively, you can pan the graph using scroll bars or click anywhere in the graph area outside the graph items and drag while the hand cursor is shown. For zooming, you can also use the mouse wheel.
The graph layout is calculated automatically, but you can change it if necessary: all items can be moved. To move an item (project, link, or grouping item), first click on it to select, and then click and drag it while the cross cursor is shown.
Using the Group by selector, you can group projects by solution folders or by file system structure. The grouping applies both in the left part and in the graph. If necessary, you can collapse and expand grouping items in the graph in one of the following ways:
- Click on the down arrow in the left top corner of the grouping item. When collapsed, the sign changes into an up arrow and you can click on it to expand the item.
- Select a grouping item in the graph and press Ctrl+plus and Ctrl+minus.
- Click Collapse Graph and Expand Graph on the toolbar to collapse or expand all grouping items.
Analyzing project references
To learn more about the usages, select the corresponding link and press Alt+F7Ctrl+K,R or Shift+F12 or right-click and choose Show Usages. ReSharper will show the usages in the Find Results window.
If the coupling analysis is over for a specific reference and ReSharper highlights it as unused (with a dotted line), you do not need to switch from the graph to remove the unused reference - just select it and press Ctrl+Shift+RCtrl+Shift+R or right-click and choose Refactor This. Then press Alt+DeleteCtrl+R,D or Alt+Delete or click Safe Delete Assembly Reference.
If you are trying to follow the best practices in solution architecture, your application probably has the layered structure with separate layers that communicate with each other.
The Show possible paths button allows you to find out whether the application layers are designed correctly, not only in terms of grouping, but also in terms of communications between the layers. In short, when the button is on, you can see whether two specific projects have a path between them consisting of other referenced projects that are currently hidden from the view. These paths are shown in green dotted lines. The button is only enabled if there are hidden intermediary projects that would link any two of the currently displayed projects.
To illustrate the way it works, consider the following example:
Imagine that we have a large solution and are now analyzing the 'Services' architecture layer
which is represented by the corresponding solution folder.
We show the two projects that we are interested in, others are hidden:
The two projects do not have direct project references between them, however, if we enable the
Show possible paths
button, we'll see that
there is a path between these projects
through other projects:
To see how these two projects can depend on each other, we right-right on the path link and
The intermediary projects appear on the graph, and we can see that they all are in another layer:
Based on this information, we can see that the application structure may need to be reworked.
Exporting graph to image
At any point of exploring project dependencies, you can export the current view to an image. To do so, click Export to PNG and specify where to save the image file.