简体   繁体   English

如何从Visual Studio 2012中编写的C#代码生成Visio 2010中的UML图?

[英]How can I generate UML diagrams from C# code written in Visual Studio 2012 into Visio 2010?

I am trying to find a way to generate UML diagrams (sequence diagrams, class diagram, etc) from my C# code written in Visual Studio 2012. 我正在尝试找到一种方法,该方法可以从用Visual Studio 2012编写的C#代码生成UML图(序列图,类图等)。

I saw a link on http://office.microsoft.com/en-us/visio-help/about-reverse-engineering-code-to-the-uml-HP001208803.aspx that I could bring my Visual Studio project into Visio. 我在http://office.microsoft.com/zh-CN/visio-help/about-reverse-engineering-code-to-the-uml-HP001208803.aspx上看到了一个链接,可以将Visual Studio项目带入Visio 。

But its first part where it says "In the Visual Studio environment, reverse engineering is activated from a command on the Project menu." 但是它的第一部分说“在Visual Studio环境中,从工程菜单上的命令激活了逆向工程。” doesn't work for me because I cannot find a reverse engineering option under the Project menu. 对我不起作用,因为在“项目”菜单下找不到反向工程选项。

How can I generate UML diagrams from C# code written in Visual Studio 2012 into Visio 2010? 如何从Visual Studio 2012中编写的C#代码生成Visio 2010中的UML图?

Microsoft no longer considers Visio to be a software engineering tool. Microsoft不再将Visio视为软件工程工具。 There was a version known as "Visio for Enterprise Architects", which had this integration with Visual Studio. 有一个称为“ Visio for Enterprise Architects”的版本,它与Visual Studio集成在一起。 It was available with the highest-end edition of Visual Studio. 最高端的Visual Studio版本提供了该功能。

I believe it was last supported with Visual Studio 2005, though that might have been 2003. 我相信Visual Studio 2005上次支持它,尽管那可能是2003年。

Visual Studio Ultimate now has its own built-in UML features which do not rely on Visio. 现在,Visual Studio Ultimate具有自己的内置UML功能,这些功能不依赖Visio。

Blast from the past. 过去的冲击波。 It's been a while since I've reverse engineered anything into UML so my knowledge may be outdated. 自从我对UML进行反向工程以来已经有一段时间了,所以我的知识可能已经过时了。 In any case, as far as I remember, code reverse engineering using Visio is a Visio feature not a Visual Studio feature, thought some versions of Visual Studio have their own modelling features. 在任何情况下,据我所知,使用Visio进行代码反向工程都是Visio功能而不是Visual Studio功能,以为某些版本的Visual Studio具有自己的建模功能。

In order to use Visio reverse engineering you need make sure the Visio UML addin is installed (it should be available in Professional and above versions of Visio, but may not be installed by default.) 为了使用Visio反向工程,您需要确保已安装Visio UML加载项(在专业版及更高版本的Visio中应该可用,但默认情况下可能未安装。)

Here 'sa rather old step by step of the process for an old version of Visio and Visual Studio. 对于旧版本的Visio和Visual Studio, 是逐步的过程。 I don't think the process has changed that much (though obviously the languages supported have changed.) 我认为流程没有发生太大变化(尽管显然支持的语言已发生变化)。

In any case I never liked Visio for UML (truth be told I never liked Visio.) I rather liked Sparx System's Enterprise Architect for modelling, and their reverse engineering was quite good when I used it on .Net 2.0. 无论如何,我从来都不喜欢Visio for UML(说实在我从来都不喜欢Visio。)我更喜欢Sparx System的Enterprise Architect进行建模,当我在.Net 2.0上使用它们时,他们的逆向工程相当不错。 I don't know how their current version copes with the newer features. 我不知道他们的当前版本如何应对较新的功能。 I also like their "from scratch" modelling environment better. 我也更喜欢他们的“从头开始”的建模环境。

Finally keep in mind UML is supposed to be a modelling not a programming language. 最后要记住,UML应该是建模而不是编程语言。 Ie it is meant to convey the high level design so the overall architecture of a solution can be more easily understood; 即,它旨在传达高级设计,以便可以更轻松地理解解决方案的总体架构; or to model key dynamic interactions, again, so the implemented or proposed solutions to the modeled problem can be more easily understood. 或再次建模关键的动态交互,因此可以更轻松地理解已建模问题的已实施或已提议解决方案。

Reverse engineered UML diagrams often have too much information for them to be useful, and it is difficult in any case to translate the precise semantics of a specific language into UML. 逆向工程UML图通常具有太多信息,因此无法使用,并且在任何情况下都很难将特定语言的精确语义转换为UML。 You may be better off creating diagrams from scratch. 从头开始创建图表可能会更好。 Other than deployment and package diagrams, it should be understood that UML diagrams represent a high level overview or specific high level dynamic interaction representation, not an as-developed representation. 除了部署图和程序包图之外,应该理解,UML图表示高级概述或特定的高级动态交互表示,而不是开发的表示。

This depends on which version of the product you are using. 这取决于您使用的产品版本。 I have Visual Studio Professional 2012 and I don't see this option. 我有Visual Studio Professional 2012,但没有看到此选项。 This makes sense if you look at the product features . 如果您查看产品功能,这将很有意义。 If, however, you look at the product features of Visual Studio 2012 Ultimate , you will see UML modelling, and various other visualisation tools. 但是,如果您查看Visual Studio 2012 Ultimate产品功能 ,则将看到UML建模和其他各种可视化工具。

Visual Studio 2010 non-Ultimate version allowed for this UML generation by using Feature Pack , which hasn't been developed for Visual Studio 2012 yet. 通过使用Feature Pack ,此UML生成允许使用Visual Studio 2010非最终版本,此功能尚未为Visual Studio 2012开发。 As Dominic mentioned (he beat me to it), Visual Studio 2012 Ultimate should allow for this though. 正如Dominic提到的(他击败了我), Visual Studio 2012 Ultimate应该允许这样做。

Visual Studio Ultimate 2012 can generate very nice sequence diagrams for C# code when you just select a member (method name); 只要选择成员(方法名称),Visual Studio Ultimate 2012就能为C#代码生成非常漂亮的序列图。 and it fails constantly at my place if I do the same for in VB code. 如果我在VB代码中执行相同的操作,它将在我的地方不断失败。

This in contrast to Enterprise Architect from Sparx, the most advanced CASE tool for UML and other modelings AFAIK. 这与Sparx的Enterprise Architect(用于UML和其他建模AFAIK的最先进的CASE工具)形成对比。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio从UML图生成代码? - Visual Studio generate code from UML diagrams? 如何从现有的C#代码生成Visio文件 - How can generate visio file from existing C# code 如何从VS2012专业版生成UML图? - How to generate UML Diagrams from VS2012 Professional Edition? 我已经使用Visual Studio Express C#为2010 Office(64位)编写了Excel代码,如何在2010 Office(32位)上运行它? - I have written excel code for 2010 Office (64 bit) with visual studio express c#, how to run it on 2010 office (32 bit)? Visual Studio 2015从代码生成UML - Visual Studio 2015 generate UML from code 如何使用Visual Studio 2015从代码生成UML图? - How do I generate UML diagram from code using Visual Studio 2015? 如何从Visual Studio 2012导出C#应用程序以在其他计算机上运行? - how can I export a C# application from Visual Studio 2012 to run in other computers? 如何正确使用C#Visual Studio 2010中另一个类中的一个类的方法 - How can I properly use methods from a class in another class in C# Visual Studio 2010 如何在Visual Studio 2010和C#中自动生成注释? - How to automatically generate comments in Visual Studio 2010 and C#? 如何从C#生成图形和图表 - How to generate graphs and diagrams from C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM