{"id":8493,"date":"2015-02-23T09:36:28","date_gmt":"2015-02-23T09:36:28","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/2015\/02\/23\/code-map-improvements-in-visual-studio-2015-ctp6\/"},"modified":"2022-07-28T01:51:18","modified_gmt":"2022-07-28T09:51:18","slug":"code-map-improvements-in-visual-studio-2015-ctp6","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/code-map-improvements-in-visual-studio-2015-ctp6\/","title":{"rendered":"Code Map improvements in Visual Studio 2015 CTP6"},"content":{"rendered":"<p><strong>Code Maps<\/strong>, previously known as Directed Graph Documents, are a great way to visualize the relationships and interdependencies between the components of your applications. They make it much easier to understand the architecture of your (or, even more useful, somebody else\u2019s) application, and where you should start when you need to update the application. Code Maps are a core part of the features of Visual Studio that help you to visualize and get insights about code.<\/p>\n<p>Since Visual Studio 2015 Preview, and based primarily on your feedback, we have improved several features related to architectural and dependency analysis using Code Maps:<\/p>\n<p>\u00b7 <a href=\"#_A_simplified_Architecture\">Simplified Architecture menu<\/a><\/p>\n<p>\u00b7 <a href=\"#_Faster_display_and\">Faster display and better responsiveness<\/a><\/p>\n<p>\u00b7 <a href=\"#_Progressively_visible_solution\">Progressively visible solution structure and dependencies<\/a><\/p>\n<p>\u00b7 <a href=\"#_Additional_dependency_link\">Additional dependency link styles<\/a><\/p>\n<p>\u00b7 <a href=\"#_Assembly_styling_depends\">Assembly styling depending on the project type<\/a><\/p>\n<p>\u00b7 <a href=\"#_Less_clutter_with\">Less clutter with implicit .NET type dependencies hidden<\/a><\/p>\n<p>\u00b7 <a href=\"#_Filters_for_code\">Filters for code elements as well as dependency links<\/a><\/p>\n<h3><a name=\"_A_simplified_Architecture\"><\/a>Simplified Architecture menu<\/h3>\n<p>In Visual Studio 2013 Update 3, the <strong>Architecture<\/strong> menu is simpler than in previous releases\u2014we added a <strong>Generate Dependency Graph<\/strong> sub menu\u2014but this is still complicated because it mixes UML designers, settings for UML code generation, and the Dependency Graph diagrams.<\/p>\n<p><img decoding=\"async\" title=\"clip_image001\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image001\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/02\/7026.clip_image001_thumb_53197336.png\" width=\"589\" height=\"151\" \/><\/p>\n<p>In the more recent in Visual Studio 2015 Preview, we added an option to create a new Code Map\u2014making things even more confusing.<\/p>\n<p>Now, in Visual Studio 2015 CTP6, you get a much cleaner <strong>Architecture<\/strong> menu:<\/p>\n<ul>\n<li>\n<p>We unified the terminology so that it refers everywhere to Code Maps, rather than sometimes to Code Maps and sometimes to Dependency Graphs or Dependency Diagrams.<\/p>\n<\/li>\n<li>\n<p>We renamed the <strong>New Diagram<\/strong> command to <strong>New UML or Layer Diagram<\/strong> to make it clear what it does.<\/p>\n<\/li>\n<li>\n<p>We made the code generation settings and XML import commands available from the UML Explorer, where they really make sense.<\/p>\n<\/li>\n<li>\n<p>We added the tool windows that you can use as drag sources for Code Maps (Class View and Object Browser) to the <strong>Windows<\/strong> submenu.<\/p>\n<\/li>\n<\/ul>\n<p><img decoding=\"async\" title=\"clip_image003\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image003\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/02\/0871.clip_image003_thumb_3F8EA446.jpg\" width=\"621\" height=\"211\" \/>**<\/p>\n<h3><a name=\"_Faster_display_and\"><\/a>Faster display and better responsiveness<\/h3>\n<p>In previous versions, it could take several minutes to generate Code Maps and Dependency Graphs. In Visual Studio2015 CTP6, we\u2019ve improved the performance of Code Maps so that dependency generation and background processing have much less impact on the responsiveness of the UI and Code Map.<\/p>\n<p>For example, creating a Code Map of the Roslyn solution, with its 58 projects, takes only a few seconds. The map is responsive immediately, even though it is still being built\u2014you can see that the dependencies between the assemblies are shown as simple gray lines until the map generation process is fully completed. Notice how Visual Studio is currently generating the map by searching for and inspecting assemblies in the background.<\/p>\n<p><img decoding=\"async\" title=\"clip_image004\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image004\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/02\/3823.clip_image004_thumb_7A0C34CB.png\" width=\"626\" height=\"410\" \/><\/p>\n<p>In addition, if you were using Code Maps to understand local dependencies in a bottom-up approach by creating the map from an element in the code editor or Solution Explorer\u2014which means it must add related elements\u2014a build was attempted every time. This could make it very slow.<\/p>\n<p>In Visual Studio 2015 Preview, we introduced the <strong>Skip Build<\/strong> toggle button in the Code Map toolbar to avoid automatic rebuilds.<\/p>\n<p><img decoding=\"async\" title=\"clip_image005\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image005\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/02\/8662.clip_image005_thumb_603A8F4D.png\" width=\"632\" height=\"61\" \/><\/p>\n<p>However, the experience was still not completely right\u2014until now. In Visual Studio 2015 CTP6, if you don\u2019t want to see the details of the link dependencies and you are happy with the initial diagram, or you want to focus on a sub-diagram using the <a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2015\/02\/12\/new-ways-to-quickly-create-a-code-map.aspx#10593119\">New Graph from Selection<\/a> command, you can use the <strong>Cancel<\/strong> link located in the information bar of the Code Map.<\/p>\n<p><img decoding=\"async\" title=\"clip_image006\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image006\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/02\/7853.clip_image006_thumb_64476DD0.png\" width=\"532\" height=\"79\" \/><\/p>\n<h3><a name=\"_Improved_solution_structure\"><\/a><a name=\"_Progressively_visible_solution\"><\/a>Progressively visible solution structure and dependencies<\/h3>\n<p>In Visual Studio 2013, with very large solutions, the resulting Dependency Graphs can be virtually un-usable because there are too many assemblies, connected to each other without any notion of grouping or layers. For example, a Dependency Graph of the 58 projects in the Roslyn solution is very large, and is missing any kind of grouping that would really make it usable. We heard from Visual Studio 2013 customers how difficult it is to get useful maps from large solutions such as this.<\/p>\n<p><img decoding=\"async\" title=\"clip_image008\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image008\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/02\/3704.clip_image008_thumb_23A7B212.jpg\" width=\"726\" height=\"79\" \/><\/p>\n<p>To be able to understand this graph, the first thing you had to do was to add groups manually and delete stuff you don\u2019t want to see. This is possible, and we\u2019ve worked with customers who found some value out in it, but it is extremely cumbersome.<\/p>\n<p>In Visual Studio 2015 CTP6, you quickly get a map representing the structure of the solution, and the map is much more useful. Assuming you have opened the Roslyn solution in Visual Studio 2015 CTP6 and built the solution, you can choose <strong>Generate Code Map for Solution Without Building<\/strong> from the <strong>Architecture<\/strong> menu to get the following diagram almost immediately. This is because Code Map crawls through the solution in the background extracting information about the projects and the solution folders.<\/p>\n<p><img decoding=\"async\" title=\"clip_image010\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image010\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/02\/5127.clip_image010_thumb_4B7048E0.jpg\" width=\"541\" height=\"848\" \/><\/p>\n<p>You can see that the projects are grouped into solution folders, which makes the diagram considerably more readable and accessible. For example, you can see the <strong>Compilers<\/strong> solution and, within this, the separate layers for <strong>CSharp<\/strong>, <strong>Visual Basic<\/strong>, some common <strong>Core<\/strong> stuff, and the <strong>Test<\/strong> project.<\/p>\n<p><a name=\"_More_useful_dependency\"><\/a>Another great feature with the progressive creation of Code Maps is that, if your solution does not build in its entirety, you will immediately know which projects built and which didn\u2019t. The structured layout makes it easy to see which project must be built first, and to specfiy the overall build order. This helps you when planning how to fix a broken build, without being overwhelmed by compiler errors.<\/p>\n<h3><a name=\"_Additional_dependency_link\"><\/a>Additional dependency link styles<\/h3>\n<p>After the initial creation of the Code Map, it does the same as it did in previous versions of Visual Studio\u2014except, now, it does all this in the background. This includes fetching the assemblies, indexing them if required, and analysing the links.<\/p>\n<p>If you wait until the dependency links have been fully analysed (it takes a minute or so for this solution), you\u2019ll notice that these links are colored, as was the case in Visual Studio 2013 Update 3 and later. The colors of the links <a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2014\/05\/27\/code-map-improvements-in-visual-studio-2013-ultimate-update-3-ctp1.aspx\">relate to the type of dependency<\/a>.<\/p>\n<p><img decoding=\"async\" title=\"clip_image011\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image011\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/02\/2783.clip_image011_thumb_45BA509C.png\" width=\"682\" height=\"358\" \/><\/p>\n<p>One interesting point you might notice is the gray dotted link between Roslyn.Services.VisualBasic.UnitTests.dll and Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll. We\u2019ve hovered over this link in the following enlarged section of the map to show the pop-up information tooltip.<\/p>\n<p><img decoding=\"async\" title=\"clip_image013\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image013\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/02\/8535.clip_image013_thumb_1933B167.jpg\" width=\"702\" height=\"169\" \/><\/p>\n<p>This link tells us that the project generating Roslyn.Services.VisualBasic.UnitTests.dll references the project generating Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll. But the link is not colored because the compiler does not really need this reference. So, unless you want to force a specific build order, it\u2019s safe to remove this unrequired reference. In fact, removing it will probably ensure that msbuild better uses its parallel build capabilities, and therefore that your solution builds more quickly.<\/p>\n<h3><a name=\"_Assembly_styling_depends\"><\/a>Assembly styling depending on the project type<\/h3>\n<p>If you look carefully at the earlier screenshots of the Code Maps, you\u2019ll see that some of the assemblies have different colors and icons. This is because they are styled based on the project types. In the case of the Roslyn solution we\u2019ve been using, most assemblies are libraries\u2014the purple ones being Visual Studio extensions (VSIX).<\/p>\n<p>However, the new styling is more obvious when you look at a Code Map for the solution we used in the keynote demonstrations during the Connect event when we released Visual Studio 2015 Preview.<\/p>\n<p><img decoding=\"async\" title=\"clip_image015\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image015\" src=\"\" width=\"700\" height=\"521\" \/><\/p>\n<p>In the following screenshot, which shows a close-up view, you can see that there is a Web Project, a Phone Project, and a Portable Library type. Note that the Test Projects are not yet styled in CTP6, but that\u2019s something we are working on.<\/p>\n<p><img decoding=\"async\" title=\"clip_image016\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image016\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/02\/2746.clip_image016_thumb_491895EC.png\" width=\"677\" height=\"309\" \/><\/p>\n<h3><a name=\"_Less_cluttered_display\"><\/a><a name=\"_Less_clutter_with\"><\/a>Less clutter with implicit .NET type dependencies hidden<\/h3>\n<p>In previous releases of Code Maps, every assembly in the display had a dependency link of type <strong>Inheritance<\/strong> with respect to <strong>mscorlib<\/strong> (and therefore to the <strong>Externals<\/strong> group). This is because all .NET types inherit from one of the mscorlib base types: <strong>System.Object<\/strong>, <strong>System.ValueType<\/strong>, <strong>System.Enum<\/strong>, or <strong>System.Delegate<\/strong>. You told us that this information is not useful because it\u2019s not something that you had coded, but was simply an implementation detail that was adding confusion and clutter to the map\u2014as well as adding processing time when generating the map.<\/p>\n<p>Since Visual Studio 2015 CTP5, Code Maps no longer represent these dependencies. Instead, you see links between assemblies and externals in colors other than green (which represents inheritance).<\/p>\n<p><img decoding=\"async\" title=\"clip_image018\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image018\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/02\/2555.clip_image018_thumb_6068BBBF.jpg\" width=\"699\" height=\"682\" \/><\/p>\n<h3><a name=\"_Filters_for_code\"><\/a>Filters for code elements as well as dependency links<\/h3>\n<p>In Visual Studio 2015 Preview, we introduced filters for links. In CTP6, we\u2019ve added a new and powerful node filtering mechanism; plus additional filters for the project references, and for the external references (references from a project to an assembly that is not built from a project in the solution). The links between nodes that belong to different groups (such as classes that belong to different namespaces) are now also filtered.<\/p>\n<p>For example, assume that you want to build a Roslyn analyser similar to the one provided by FxCop. You can find one in Solution Explorer (for example, the class <strong>CA1813DiagnosticAnalyzer<\/strong>) and add it to a new Code Map. Get all of its base classes (open the shortcut menu, choose <strong>Advanced<\/strong>, and then choose <strong>Show All Base Types<\/strong>), and then get the containing namespaces and assemblies (<strong>Select All<\/strong>, and then <strong>Advanced | Show Containing Namespace and Assembly<\/strong>). The result is a diagram such as the following (we chose <strong>Bottom to Top Layout<\/strong> from the <strong>Layout<\/strong> menu so that the base class is at the top).<\/p>\n<p><img decoding=\"async\" title=\"clip_image019\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image019\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/02\/2117.clip_image019_thumb_0A6DDB4A.png\" width=\"396\" height=\"460\" \/><\/p>\n<p>Now we can uncheck the check boxes in the <strong>Filters<\/strong> window so that the map shows only the details we\u2019re interested in. For example, by unchecking <strong>Namespace<\/strong> we get a grouping of classes by the assemblies where they are defined, but skipping the Namespace level.<\/p>\n<p><img decoding=\"async\" title=\"clip_image020\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image020\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/02\/0827.clip_image020_thumb_57A06586.png\" width=\"518\" height=\"296\" \/><\/p>\n<p>Conversely, we can check <strong>Namespace<\/strong> and un-check <strong>Assembly<\/strong> and <strong>Class<\/strong> to get the type of namespace dependency diagram that many customers have requested (with the caveat that if two namespaces have the same name but belong to different assemblies they will still be represented as different groups: that\u2019s the current model of Code Maps).<\/p>\n<p><img decoding=\"async\" title=\"clip_image021\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image021\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/02\/3857.clip_image021_thumb_5DE9CCC5.png\" width=\"543\" height=\"277\" \/><\/p>\n<p>Filtering on test assemblies is not yet available, but we\u2019ve heard from you that you sometimes want to be able to focus only on production code. Test assembly filtering is something we want to do in future release.<\/p>\n<h3>Got feedback?<\/h3>\n<p>Please try the improved Code Maps and send your feedback, ideas, and requests to vsarchfeedback@microsoft.com<\/p>\n<p>Thank you,<br \/>\nThe Code Insights team<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Code Maps, previously known as Directed Graph Documents, are a great way to visualize the relationships and interdependencies between the components of your applications. They make it much easier to understand the architecture of your (or, even more useful, somebody else\u2019s) application, and where you should start when you need to update the application. Code [&hellip;]<\/p>\n","protected":false},"author":112,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,251],"tags":[],"class_list":["post-8493","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","category-security"],"acf":[],"blog_post_summary":"<p>Code Maps, previously known as Directed Graph Documents, are a great way to visualize the relationships and interdependencies between the components of your applications. They make it much easier to understand the architecture of your (or, even more useful, somebody else\u2019s) application, and where you should start when you need to update the application. Code [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/8493","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/112"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=8493"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/8493\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=8493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=8493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=8493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}