How to: Find Code Using Architecture Explorer
In Visual Studio Ultimate, you can select vertical sections or "slices" of code that you want to visualize by using Architecture Explorer. You can explore source code in a Visual Studio solution or compiled code. You can use Architecture Explorer to browse other domains by installing additional providers. When you find the code that you want to visualize, you can generate graphs to explore the relationships in that code. For more information, see How to: Generate Dependency Graphs for .NET Code.
Note
In Visual Studio 2010 Ultimate, Architecture Explorer supports only Visual C# .NET and Visual Basic .NET. To explore C or C++ code, download and install Visualization and Modeling Feature Pack. The following types in Architecture Explorer apply only to C and C++ code: Unions, Typedefs, and Members and will not show results when you select them. For more information, see Microsoft Visual Studio 2010 Visualization and Modeling Feature Pack.
In This Topic
About Architecture Explorer
Find source code in a Visual Studio solution.
Find compiled code in managed assembly or executable files.
Refine your browsing results.
Refresh your browsing results.
You can save your browsing session as a query (.dgql file) so that you can reuse it later:
Save your browsing session as a query.
Find saved queries.
About Architecture Explorer
To open Architecture Explorer
On the Architecture menu, point to Windows, and then click Architecture Explorer.
To resize Architecture Explorer, drag the top of the window to the height that you want. To move ArchitectureExplorer, drag its title bar, or tab, to the position that you want.
Note
If any windows appear above Architecture Explorer, such as the Error List window or the Output window, move those windows so that they do not prevent you from resizing Architecture Explorer.
Architecture Explorer: Domains, views, nodes, node types, and link types
Architecture Explorer represents structures as nodes and relationships as links. As you browse, Architecture Explorer displays nodes in successive columns. The first column shows the domains and views that you can browse. When you select a domain and a view, Architecture Explorer shows you the available nodes in that view.
When you select nodes in a column, the next column in Architecture Explorer shows you nodes that are logically related to your selection. For example, if you select namespaces, you will see types in the next column. If you select types, you will see members in the next column. The collapsed action column that appears along the right side of a node column identifies the default types or relationships of the nodes that the next column contains. You can filter the results of the next column by expanding the action column and selecting specific types of nodes or links.
Note
The action column appears highlighted when you move the pointer over it.
Find Source Code in a Visual Studio Solution
To use the predefined queries that are included with this release, see Find Saved Queries. Otherwise, you can use Solution View or Class View in Architecture Explorer to browse source code down to the level of expression trees:
Class View shows you a logical view of a Visual Studio solution. For example, you can browse by namespace, classes, members, and so on.
Class View in Architecture Explorer
Solution View shows you physical view of a Visual Studio solution. For example, you can browse by project, project files, and so on.
Solution View in Architecture Explorer
To find code in your solution
In the first column of Architecture Explorer, under Visual Studio <solution name>, click Class View or Solution View.
A node column appears to the right of the first column. This column shows all the nodes that are available in the selected view. For example, if you selected Class View, you see all the namespaces that logically exist in your solution.
In the node column, select a node or multiple nodes to see the next column of related nodes. To select all the nodes in the current column, press CTRL+A.
Repeat step 2 until you find the nodes that you want.
Note
To restart your query by clearing the columns, under the Architecture Explorer title bar, click Clear Columns.
Find Compiled Code in Managed Assembly or Executable Files
Use Select Files in Architecture Explorer to browse managed assemblies down to the level of method-to-method calls.
To find compiled code
On the Architecture menu, point to Windows, and then click Architecture Explorer.
In the first column, under File System, click Select Files.
In the Open dialog box, browse to the managed assembly (.dll) or executable (.exe) files, select them, and then click Open.
A node column appears and shows the selected files.
In the node column, select a file or multiple files.
Another node column appears and shows all the nodes in the selected files.
Select a node or multiple nodes to see the next column of related nodes. To select all the nodes in the current column, press CTRL+A.
Repeat step 4 until you find the nodes that you want.
Refine Your Browsing Results
You can refine the results of your browsing session in the following ways:
Filter nodes in the current column by name.
Filter nodes in the current column by node type or property.
Filter nodes in the next column by node type.
Filter nodes in the next column by link type.
Group nodes by container or property value
Filter Nodes in the Current Column By Name
Filter the current column by name
To filter nodes in the current column by name
In Architecture Explorer, at the top of the node column, click the shaded area to show the filter box.
Type the name, and then press ENTER.
The current column shows only the matching nodes. The lower-right corner of the column displays a watermark to show that the column is filtered.
Filter Nodes in the Current Column By Node Type or Property
Filter the current column by type or property
To filter nodes in the current column by type or property
In Architecture Explorer, at the top of the node column, click the shaded area to show the filter box.
To the left of the filter box, click the Filter items in the current column by category or property button.
To show only those nodes of a specific type, under Categories, click the types that you want.
To show only those nodes with specific properties, under Properties, click the properties that you want.
When you are finished, click OK.
The current column shows only the matching nodes. The lower-right corner of the column displays a watermark to show that the column is filtered.
Filter Nodes in the Next Column By Node Type
To filter nodes in the next column by node type
In Architecture Explorer, browse to the node column that comes before the nodes that you want to see, and then select the nodes that you want.
On the right side of the node column, click the collapsed action column to expand it.
Note
The action column appears highlighted when you move the pointer over it.
In the action column, under Node Navigation, select the specific types of nodes that you want to see next.
Note
To see a union of these types, select multiple types.
A node column appears and shows any matching nodes.
Filter Nodes in the Next Column By Link Type
Architecture Explorer organizes the link types that are used to filter the next set of nodes into two categories: inbound or outbound. These categories describe the direction of the link relative to the currently selected node. An outbound link points from the currently selected node to the next related node. An inbound link points from the previous related node to the currently selected node. When you select an outbound link type, Architecture Explorer shows you the next level of related nodes. When you select an inbound link type, Architecture Explorer shows you the previous level of related nodes.
For example, if you select a class node, and you select the outbound Contains link type, Architecture Explorer shows you the nodes that the class node contains. If you select the inbound Contained By link type for that class node, you see nodes that contain that class, such as namespaces, class files, and projects.
To filter nodes in the next column by link type
In Architecture Explorer, browse to the node column that comes before the nodes that you want to see, and then select the nodes that you want.
On the right side of the node column, click the collapsed action column to expand it.
Note
The action column appears highlighted when you move the pointer over it.
In the action column, select one of the following:
To see related nodes at the next level, under Outbound Navigation, select the link types that you want.
To see related nodes at the previous level, under Inbound Navigation, select the link types that you want.
Note
To see a union of these types, select multiple types.
The next column appears and shows any matching nodes.
Group Nodes by Container or Property Value
In Architecture Explorer, you can create groups of nodes based on either their existing containment relationships or their property values. If grouping is possible, a list of new group nodes will appear when you complete this task.
When you create a graph from these groups in Architecture Explorer, you can use the Show All as Groups command to organize linked nodes into groups. For more information, see the following topics:
You can also use groups to organize nodes on an existing graph. For more information, see How to: Edit and Customize Graph Documents.
To group nodes by container or property value
In Architecture Explorer, browse to the node column that contains the nodes that you want to group. To select all the items in the column, press CTRL+A.
On the right side of the node column, click the collapsed action column to expand it.
Note
The action column appears highlighted when you move the pointer over it.
In the action column, under Grouping:
Click
Then
Group by Containers to see any available groups
To see nodes that are in these groups, select some groups.
The next column shows the nodes that are in the selected groups.
Group by Properties to see any available properties
Select the properties that you want to use as groups.
The next column shows groups organized by property value.
To see nodes that have specific property values, select some property value groups.
The number and kinds of groups that you see are based on the types of the property values:
Boolean values: True and False
Integer values: Four groups that divide the range of values into even quartiles.
String values: A group appears for each unique string value, and nodes belong to each group based on their particular property value.
This is most useful when the selected property has the same string value across multiple nodes. For example, if you select a property has a unique string value for each node, then you will get one group per node.
Refresh Your Browsing Results
You must refresh Architecture Explorer manually to show any changes that are made to the code or solution.
To refresh Architecture Explorer
In Architecture Explorer, browse to the node column that comes before the column that you want to refresh.
In the current column, select the nodes that are related to the updated nodes.
Another node column appears to shows the refreshed list of nodes.
Save Your Browsing Session as a Query
You can save your browsing session in Architecture Explorer as a query, or Directed Graph Query Language (.dgql) file. You can save a query to disk for later use or to generate graphs in batch mode by using the GraphCmd.exe tool. For more information about generating graph documents in batch mode and DGQL, see How to: Generate Dependency Graphs for .NET Code.
To save your browsing session
Under the Architecture Explorer title bar, click Save Query.
In the Save As dialog box, name the query and save it as a .dgql file to local Queries folder at the following location:
…\My Documents\Visual Studio 2010\ArchitectureExplorer\Queries
Note
To see your query in Architecture Explorer, you must save the .dgql file to the Queries folder, or add it to your solution. For more information, see Find Saved Queries.
Find Saved Queries
You can use Architecture Explorer to find query (.dgql) files when you add them to your Visual Studio solution, or when you save them in the following local Queries folder: …\My Documents\Visual Studio 2010\ArchitectureExplorer\Queries. This folder also contains commonly-used predefined queries.
For more information about how to save your browsing session in Architecture Explorer as a query, see Saving Your Browsing Session.
Queries in your solution
To find queries in your solution
On the View menu, click Architecture Explorer.
In the first column, under Saved DGQL Queries, click In My Solution to see a column of query (.dgql) files.
In the query files column, click a query file.
Another column appears and shows nodes from the selected query.
Select a node or multiple nodes to see the next column of related nodes. To select all the nodes in the current column, press CTRL+A.
Repeat step 4 until you find the nodes that you want.
To find queries in the local Queries folder
On the View menu, click Architecture Explorer.
In the first column, under Saved DGQL Queries, click In Folders to see a list of query (.dgql) files.
The following table lists predefined queries that you can use to explore items in your solution:
Query file name
Shows
All Assembly References.dgql
All assemblies that are referenced by the solution.
From the query results, you can generate a graph that shows the dependencies between these assemblies. For more information, see How to: Generate Dependency Graphs for .NET Code.
All Output Assemblies.dgql
A flat list of all the output assemblies in the solution without dependency links.
From the query results, you can generate a dependency graph for selected assemblies:
In the current column, select the assemblies that you want to explore.
Along the right side of the current column, click the collapsed action column to expand it.
NoteThe action column appears highlighted when you move the pointer over it.In the action column, under Commands, click Standard Graph.
All Project References.dgql
All references between projects in the solution.
From the query results, you can generate a graph that shows the references between these projects. For more information, see How to: Generate Dependency Graphs for .NET Code.
All Projects.dgql
A flat list of all projects in the solution.
If your solution includes solution folders, this list differs from the one shown when you click Solution View in Architecture Explorer.
Constructors.dgql
A flat list of all constructor methods
Inheritance Graph.dgql
All types in the solution that have the following relationships:
Inherits From
Implements
From the query results, you can generate a graph that shows the inheritance relationships between these types. For more information, see How to: Generate Dependency Graphs for .NET Code.
Public Classes.dgql
A flat list of all public classes in the solution
Virtual Members.dgql
A flat list of all virtual members in the solution
In the query files column, click a query file.
A node column appears and shows nodes from the selected query.
In the node column, select a node or multiple nodes to see the column of related nodes. To select all the nodes in the current column, press CTRL+A.
Repeat step 4 until you find the nodes that you want.