如何获取 C# 项目之间的依赖关系图

发布于 2024-09-16 01:53:44 字数 353 浏览 8 评论 0原文

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

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

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

秋风の叶未落 2024-09-23 01:53:44

你可以看看 NDepend : http://www.ndepend.com/

编辑< /em> 添加:

Patrick Smacchia,NDepend 的首席开发人员,博客在这里:http://codebetter.com/blogs/patricksmacchia/default.aspx 并写了很多关于组件化主题的文章,您可能会发现有用。

You could have a look at NDepend : http://www.ndepend.com/

edit to add:

Patrick Smacchia, lead developer of NDepend, blogs here: http://codebetter.com/blogs/patricksmacchia/default.aspx and has written much on the subject of componentisation, which you may find useful.

靑春怀旧 2024-09-23 01:53:44

如果您有权访问 Visual Studio 2010 Ultimate,则可以从体系结构 菜单中选择生成依赖关系图

MSDN 上有一个演练:如何:为 .NET 代码生成依赖关系图< /a>

If you have access to Visual Studio 2010 Ultimate, you can select Generate Dependency Graph from the Architecture menu.

There is a walkthrough on MSDN: How to: Generate Dependency Graphs for .NET Code

悲凉≈ 2024-09-23 01:53:44

工具 NDepend 提出了与依赖矩阵相结合的依赖图。默认情况下,您将获得 .NET 程序集的依赖关系图,并且它不限于仅一个 VS 解决方案的程序集。 NDepend 集成在 VS 2017、2015、2013、2012、2010 中,它可以在代码上显示任何类型的图,包括:

  • 之间的依赖关系
  • 程序集方法调用图
  • 、 VS 项目内命名空间的依赖关系、
  • 命名空间内类型的依赖关系、
  • 类继承图、
  • 表示两个组件之间的类耦合的图

等...

这一切都在这里进行了解释< /a>.

NDepend 代码图依赖关系图

NDepend还提出了一个依赖结构矩阵(DSM ) 以及使用 C# LINQ 查询查询依赖项的方法。

The tool NDepend proposes 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 2017, 2015, 2013, 2012, 2010 and it can show any kind of graph on your code including:

  • dependencies between assemblies
  • method call 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...

This is all explained here.

NDepend code graph dependency diagram

NDepend also proposes a dependency structure matrix (DSM) and a way to query dependencies with C# LINQ queries.

许一世地老天荒 2024-09-23 01:53:44

我会尝试将其导入到 UML 工具中,该工具可以为我呈现模块之间的依赖关系图。

市场上有几种,包括商业的和开源的。选择一款能够为您的预算提供最大功能的产品。

I'd try importing it into a UML tool that could render the dependency diagram between modules for me.

There are several on the market, both commercial and open source. Get the one that gives you the most capability for your budget.

乖乖公主 2024-09-23 01:53:44

如果您对程序集级别信息感到满意,那么您应该查看图表流行工具 Reflector 的插件。它提供组装和类级别依赖图。

If you are OK with assembly level information then you should look at Graph add-in to a popular tool Reflector. It provides assembly & class level dependency graph.

黑凤梨 2024-09-23 01:53:44

The latest Resharper version is also capable of creating the reference diagramm.

https://www.jetbrains.com/help/resharper/Architecture__Project_Dependencies_Exploration.html#

断念 2024-09-23 01:53:44

今天早上向我建议理解(:

http://www.scitools.com/

但老实说我不能给一个适当的报告,因为它对我来说太贵了......

understand was suggested to me this morning (:

http://www.scitools.com/

but honestly i cannot give a proper report on it, since it is too expensive for me...

思念满溢 2024-09-23 01:53:44

看看我的 .NET Reflector 的免费 DSM 插件,可从 www.tom-carter.net

下载允许对依赖关系有两种不同的视图:用于查找程序集之间的依赖关系的部署模型和用于显示类型之间的依赖关系的体系结构模型。

如果它没有直观地提供您要查找的信息,您可以将模型保存到 xml 并在数据上运行您自己的脚本。

依赖矩阵的优点在于,它比方框图和折线图更容易直观地分析依赖关系

如果您需要更多帮助,请立即联系我

[更新]该插件现在以 Visual Studio 的形式提供插件

Have a look at my free DSM plugin for .NET Reflector downloadable from www.tom-carter.net

It allows two different views on your dependencies : a deployment model to find the dependencies between assemblies and an architectural model to show dependencies between types.

If it does not provide visually the information your looking for, you can save the model to xml and run your own script on the data.

The advantage of a dependency matrix is that its much more easier to analyse dependencies visually than box and line graphs

If you need more help let me now

[Update] This plugin is now available in form of a Visual Studio Add-In

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文