How can I generate UML diagrams from C# code written in Visual Studio 2012 into Visio 2010?
Asked Answered
C

5

13

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.

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.

But its first part where it says "In the Visual Studio environment, reverse engineering is activated from a command on the Project menu." 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?

Cripps answered 12/11, 2012 at 16:49 Comment(0)
P
11

Microsoft no longer considers Visio to be a software engineering tool. There was a version known as "Visio for Enterprise Architects", which had this integration with Visual Studio. It was available with the highest-end edition of Visual Studio.

I believe it was last supported with Visual Studio 2005, though that might have been 2003.

Visual Studio Ultimate now has its own built-in UML features which do not rely on Visio.

Parterre answered 4/12, 2012 at 23:18 Comment(7)
This is unfortunate, as the built-in UML features do not support C++ reverse engineering. I now have the same problem as xEnOn (but with C++ instead of C#), and from what you're saying it sounds like there's no way to achieve what I want with either VS2012 by itself or in combination with Visio?Pow
Have you checked Visual Studio 2012 Update 1? They added a bunch of C++ features, and maybe UML support for C++ is one of them.Parterre
Yes, I've tried Update 1. Still no C++ support, sadly. I do like a lot of the other C++ features they've added though (new item templates, GPU support, unit test framework, etc.).Pow
Digging through Microsoft site, I find references to using Visio 2003 and Visio 2007 to reverse engineer code into UML. 2003 instructions found at: office.microsoft.com/en-us/visio-help/… 2007 Reverse Engineering instructions (for VB6 using Visio 2007) found at: office.microsoft.com/en-us/visio-help/…Underbrush
Why do you care about ancient versions of ancient tools? Those are not current.Parterre
@JohnSaunders There are plenty of circumstances that may require one to use specific versions of specific software. Whether or not they fall under some subjective definition of "current" is irrelevant.Bluegreen
@b1nary: "current" is a very objective measure, "not current" even more so. 2007 << 2015, and UML 1.2 is not what was meant when your boss says "UML diagram".Parterre
M
6

Blast from the past. It's been a while since I've reverse engineered anything into UML so my knowledge may be outdated. 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.

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.)

Here's a rather old step by step of the process for an old version of Visio and 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. 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. I.e. 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. 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.

Mode answered 4/12, 2012 at 23:11 Comment(0)
A
0

This depends on which version of the product you are using. I have Visual Studio Professional 2012 and I don't see this option. 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.

Axinomancy answered 4/12, 2012 at 22:2 Comment(1)
True, but this UML Modeling feature is not related to Visio, which is what the question was about.Parterre
E
0

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. As Dominic mentioned (he beat me to it), Visual Studio 2012 Ultimate should allow for this though.

Einkorn answered 4/12, 2012 at 22:24 Comment(0)
C
0

Visual Studio Ultimate 2012 can generate very nice sequence diagrams for C# code when you just select a member (method name); and it fails constantly at my place if I do the same for in VB code.

This in contrast to Enterprise Architect from Sparx, the most advanced CASE tool for UML and other modelings AFAIK.

Catena answered 6/2, 2014 at 12:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.