-
-
Notifications
You must be signed in to change notification settings - Fork 213
Graph
MSBuild Structured Log Viewer now includes a graph viewer control.
Right-click a project or evaluation and select Target Graph to view the target dependency graph for that project:

Right-click a project or evaluation and select NuGet Graph to view the NuGet dependency graph for that project.
Right-click the NuGet node at the root level and click NuGet Graph to view the NuGet dependency graph for the entire build.
The vertices are organized into horizontal layers by the height of each vertex.
As an example, a project's height is defined as follows:
- projects that don't have any references have the height of 0
- if the maximum height of the project's reference is N, then the height of the project itself is N + 1
A project can only reference projects from the layers above it. A project can't reference projects from the same layer or from the layers beneath it.
Within a layer, projects are ordered by in-degree (number of projects that reference it) descending. Thus, more "popular" projects that are referenced more appear towards the left. The spine of the graph is along the left vertical edge (most popular projects in each layer).
A project will be a deeper shade of blue if it has larger depth. Depth is defined similarly to height, but from the opposite end. Unreferenced projects have a depth of 0, and for a referenced project the depth is one bigger than the maximum depth of all referencing projects. Projects with greater depth will also have a slightly taller rectangle.
Check the Layer by depth checkbox to order the layers by node depth. This way all unreferenced projects (depth = 0) will be in the bottom most layer.
Some people have different mental models about whether more foundational layers are at the top or on the bottom. Use the Invert checkbox to flip the graph to the opposite end.
Some people may also prefer flipping the direction from vertical to horizontal, using the Horizontal checkbox.
To find a vertex in a large graph by name, type the partial name into the textbox and click Locate on canvas. Once a vertex is selected, you can click Go to search to list outgoing and incoming references using the syntax described here.
Clicking on a project shows all outgoing references (above) and all incoming references (below).
If there are too many references, check the Hide transitive references checkbox to only show the transitive reduction of the graph. It doesn't change the graph connectedness (if two vertices were connected, they will still be connected, albeit indirectly).
Ctrl+Click any two vertices to see whether one references the other, and if so, what are the possible paths from one to the other.
Click on Show graph text to get the Dot syntax for the current graph:
digraph {
"StructuredLogger.Tests" -> "StructuredLogViewer.Core"
"StructuredLogger.Tests" -> StructuredLogger
"StructuredLogger.Utils" -> StructuredLogger
"StructuredLogViewer.Avalonia" -> "StructuredLogViewer.Core"
"StructuredLogViewer.Avalonia" -> StructuredLogger
"StructuredLogViewer.Core" -> StructuredLogger
BinlogTool -> "StructuredLogger.Utils"
BinlogTool -> StructuredLogger
StructuredLogViewer -> "StructuredLogger.Utils"
StructuredLogViewer -> "StructuredLogViewer.Core"
StructuredLogViewer -> StructuredLogger
StructuredLogViewer -> TaskRunner
TaskRunner -> "StructuredLogViewer.Core"
TaskRunner -> StructuredLogger
}
You can use File -> Open Graph to open arbitrary directed graph files in .dot format.
As an example, you can obtain a graph for a directory with .dll files by running the refdump .NET tool:
dotnet tool update -g refdump-
refdump -gwhich will output the assembly dependency graph to a file in the current directory. You can then open the graph file using File -> Open Graph. It will display in a separate graph control that's not related to the build. The MSBuild Structured Log Viewer is opening directed graph files as a convenience.
See also the Dependency Analyzer tool by Drew Noakes: https://github.com/drewnoakes/dependency-analyser