我如何获取我的C#项目之间的依赖关系图 [英] How do I get a diagram of the dependencies between my C# projects

查看:1412
本文介绍了我如何获取我的C#项目之间的依赖关系图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个相当复杂的应用程序已被分解成多个组件。每个组件都有一个包含一堆项目的解决方案文件。所以我喜欢认为这是一个组件有多个项目/ DLL。还有一个通用组件。所有其他组件都取决于常用。所以编译如下所示:
nant component1.compile将编译common,然后编译component1,因为component1依赖于common。
随着时间的推移,共同已经变得相当大。我很确定它可以分成几个较小的组件。那么组件只需要依赖于一些这些较小的共同。这将有望减少不同组件的编译时间。



所以问题:
我想可视化应用程序中所有不同项目之间的依赖关系,同时标记项目所属的组件。你会怎么做?

解决方案

NDepend附带一个



alt text http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.CQLExport/Graph1.jpg


I have a fairly complex application which has been broken up into multiple components. Each component has a solution file which contains a bunch of projects. So I like to think of this as a component has multiple projects/dlls in it. There is also a "common" component. All the other components depend on "common". So a compile goes like this: "nant component1.compile" will compile "common" and then compile component1 since component1 depends on "common". Over time "common" has become quite big. I'm pretty sure it can be split into a few smaller components. Then components need to depend only on some of these smaller, broken up "common". This would hopefully cut down on compile time for the different components.

So question: I'd like to visualise the dependency between all the different projects in the application while also tagging which component the project belongs to. How would you do this?

解决方案

NDepend comes with a dependency graph coupled with a dependency matrix. By default you'll get a dependency graph of .NET assemblies and it is not restricted to assemblies of only one VS solution. NDepend is integrated in VS 2010, 2008 and 2005 and it can shows any kind of graph on your code including:

  • dependencies between assemblies
  • method calling graph,
  • dependencies of namespaces inside a VS project,
  • dependencies of types inside a namespace,
  • classes inheritance graph,
  • graph representing classes coupling between 2 components

etc...

See screenshoots extracted from this blog post: Interactive Code Dependencies Graph

alt text http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.Graph/InternalDependenciesGraphSmall2.jpg

alt text http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.Graph/CycleGraphSmall2.jpg

alt text http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.CQLExport/Graph1.jpg

这篇关于我如何获取我的C#项目之间的依赖关系图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆