This site uses cookies to deliver our services. By using this site, you acknowledge that you have read and understand our Cookie and Privacy policy. Your use of Kontext website is subject to this policy. Allow Cookies and Dismiss

Understand Code Dependencies with Visual Studio

554 views 0 comments last modified about 4 years ago Raymond

In this page

Visual Studio provides a convenient tool to generate visual code dependencies. It helps to identity circular references issues and also hubs.

To learn more details about this function, visit http://msdn.microsoft.com/library/dd409453(VS.110).aspx.

Find the tool

Go to menu “Architecture –> Generate Dependency Graph” and you will be able to generate the visual diagrams for your projects or solution.

image

Sample – Hub

image

ContextProject.DataServices.The above diagram shows how my projects reference to each other.  Three projects are Hubs: ContextProject.Website, ContextProject.DataServices.Syndication, ContextProject.DataServices.MetaWeblog and ContextProject.DataServices, which implies that they are the top 25% highly connected nodes.

image

Because of these dependencies, it is hard to change and maintain the code. We can refactor can components to reduce the complexity of dependencies.

Sample – Circular Reference

Expand the assembly nodes,  we can identify the circular references.

image

In the above diagram, three namespaces form a circular reference. Drilling-down to details, I find out the static property Configurations caused this issue.

image

Sample – Other

I am planning to replace my IoC component NInject with Microsoft Unity. The visual dependency diagram can help me to find out all the classes/properties/methods I need to change.

image

Summary

The visual dependencies can help us identify code that might be overly complex or that might need improvement. It will be very useful when you begin to analyze a new project you didn’t work on before.

Related pages

ASP.NET Core 2 with Bootstrap 4 Bundler Minifier Issue: Expected semicolon or closing curly-brace found '-'

766 views   1 comments last modified about 7 months ago

Background When upgrading Bootstrap to v4.0.0 release, the bundler and minifier doesn’t work properly due to CSS variable is commonly used: :root{--blue:#007bff; About 26 errors will show up in the Error List with the following message: ...

View detail

Migrate ASP.NET Core Projects – VS2015 to VS2017 and TFS2015 to TFS2017 Issues and Fixes

423 views   0 comments last modified about 2 years ago

Context Before Visual Studio 2017 was released, I was implementing my ASP.NET Core project using VS2015. TFS2015 is used for Continuous Build and Deployment for my projects. After migrating to VS2017, there are couple of issues I encountered in my environment: VS2017 has ...

View detail

开始下载安装Visual Studio 11 Beta吧!

247 views   0 comments last modified about 7 years ago

  ...

View detail

Visual Studio 2011 New Features 新增特性汇总

257 views   0 comments last modified about 7 years ago

本文将介绍Visual Studio 11 Express for Windows Developer Preview中包含的新特性。

View detail

VS2010新增的IDE特性与功能之C#程序员篇

278 views   0 comments last modified about 9 years ago

注:本文参照MSDN博客C# FAQ的文章http://blogs.msdn.com/csharpfaq/archive/2010/05/10/new-ide-features-in-visual-studio-2010-for-c-developers.aspx;但不是完整翻译,而是提取主要内容以供大家参考,感谢原作者的奉献。一,Generate From Usage 从使用生成代码

View detail

VS2010新特性-Modeling Project-UML Sequence Diagram 时序图

320 views   0 comments last modified about 9 years ago

时序图展现了一组对象和由这组对象收发的信息,用于按时间顺序对控制流建模。可以用时序图来说明系统的动态视图。一,新建时序图

View detail

Add comment

Please login first to add comments.  Log in New user?  Register

Comments (0)

No comments yet.