Visual Studio 2015 generate UML from code - c#

Windows 10 64-bit
Microsoft Visual Studio Enterprise 2015 Version:14.0.25431.01 Update 3
I have a almost finished project and now I need to write a documentation. I found some information in the www which tells to "simply" generate UML from the existing code.
At the top Menu is a section with Architecture and there I can create new UML diagrams, but I can't import the classes which the project have. In all the other forum entries they was talking about a Architecture Explorer where you can simply drag and drop the needed classes and the dependencies are automatically created, but in my case this view is missing.
If you have some good advise how to document the software differently, you're welcome.

In solution explorer right click and:
add > item.. > General > class diagram
Then you can fairly easy make a domain model by dragging entity classes in and right click on a few properties and choose: "Show as association"

To view UML diagram of your project, make right-click on your project and select View->Class diagram. Auto-generated UML of your project will be opened

Related

Where is Class Diagram on Visual Studio 2017 community edition

I could not find how to generate existing class diagrams on VS2017 Community Edition. Is it not available to Community Editions. Could you please help how can I generate class diagrams of the project?
I assume you mean class diagrams, not UML diagrams.
Starting with Visual Studio 2017, the support for class diagrams is not installed by default. You need to explicitly select it during installation:
From the Start menu, launch Visual Studio Installer.
Click Modify button for your installation.
Switch to Individual components tab, scroll down and select Class Designer. Press Modify button.
The complete procedure with screenshots is described here (because our product VSdocman also relies on this feature if you want to generate class documentation with the diagrams).
I have the impression that you're not talking about the UML diagram feature which was retired indeed. I'm assuming you're talking about the Class Diagram.
First of all as Peter pointed out, make sure this feature is installed in your system.
Then, as answered here, it's a known issue (VOTE!)
As a workaround, From the New File dialog box create a plain XML named Diagram.cd (replace Diagram with your choice), right click the file and select Open With..., and select XML (Text) Editor, then replace its contents with the following:
<?xml version="1.0" encoding="utf-8" ?>
<ClassDiagram MajorVersion="1" MinorVersion="1">
<Font Name="Segoe UI" Size="9" />
</ClassDiagram>
Then close the file saving it. When you reopen it normally it should work now.
Community edition doesn't allow you to do it.
Version support for VS 2015 for architecture and modeling tools
Apparently Microsoft has decided to not add that functionality in Visual Studio 2017, for any of the product versions
blogs.msdn.microsoft.com

Can't add Business Module or Foundation Module in Smart Client solution. Visual Studio 2015

I've recently switched from VS 2010 professional to VS 2015 Community and I have encountered a problem with the Smart Client Software Factory 2010. I have downloaded and installed the GAX and Smart Client Software Factory for VS2015. I am able to create a Smart Client application (C#) and I get the usual template projects within the Infrastructure folder (which in turn is placed in the Source folder), Shell, Interface, Library and others. Now the problem I have encountered is that I cannot add Business Modules to the solution. I can't do it through the "New Project" wizard nor through right-clicking on the source folder and picking "Smart Client Software Factory 2010" -> "Add Business Module". The "Smart Client Software Factory 2010" option isn't even in the right-click menu. The only place it is showing up is in the right click menu for the created projects, and the sub-menu only gives the "Create View with presenter" options.
Any ideas what causes this strange behaviour and how I might fix it? Thanks.
UPDATE
I dug around some more and in guidance navigator I see the "Add Add Fundational(C#) Module" and "Add Add Business Module(C#)" as templates. (Not a typo the word Add appears twice)
When I click "unfold this template" I get a window with my solution tree:
but when I then select source (because that is where I want the business module to be created and click accept nothing happens and Visual Studio gives me the following message:
Something that I forgot to mention in the original message is that I also installed GAT and enabled it in the Guidance Automation Manager.
So any ideas?
Silly me. This seems to be one of those things that you don't even think of trying out. Apparently in order for scsf to be able to start of its "New Project" wizard (which business module and foundational module are, they are new projects within the solution) you have to run Visual Studio as admin. Once I did that the Guidance Navigator was able to add the mentioned modules to the solution.

Changing variable name as I add it (VS, .NET4, C#)

I'm working on a program and I had this problem:
when I add a button, for example, it's called automaticly button1, button2, etc.
I want the posibility to name it as I want it to be called right when I add it without the need of changing the 'Name' in the properties. Like you add a new Form and can name it as I you want, like that just for button, textboxes, etc.
Thanks
You should look into the Visual Studio 2010 Visualization and Modeling SDK. It answers your need, here is Microsoft introduction to it on MSDN
Domain Specific Languages (DSL Tools) and Architecture Tools SDK for Microsoft > Visual Studio 2010. This SDK provides tools and templates for building Visual > Studio Domain Specific Language designers for Visual Studio 2010 and extending > UML and Layer designers. By using this SDK, you can build your own graphical
or form-based designers for Visual Studio 2010 and extend existing tools.

Reverse engineering option in Visual studio 2008 arch edition

We have visual studio 2008 architecture installed and a c# solution created. We need to generate UML diagram (showing the classes, the relationship between them etc). In the architecture edition we don't see any option that would generate such diagram. The option of class digram mearly generates the class diagram but do not show such relationship.
Is anyone aware of this?
Thanks in advance.
AFAIK UML diagrams are non existent in VS 2008
They should be available in VS 2010
Best bet here: download a tool that can import the existing code and create diagrams
try Enterprise architect- http://www.sparxsystems.com/
HTH
You need to install Visio 2003 or Visio 2007 to generate UML diagrams from within Visual Studio.
Also note, not sure what relationships you're looking to see, but any property that references an object, you can right-click and pick 'Show Association', which will connect those on the diagram.
Also also, you can download the power tools for architecture edition to give you more diagramming abilities in the designer: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=5ef45ad4-336b-4a37-aded-ee9c9d8e6f8d&DisplayLang=en
Edit: Apparently this was removed from VS2008. If you have access to Visual Studio 2005, there are steps here for reverse-engineering a 2008 project in 2005.

Code stubbing with Visual Studio 2010 UML modeling

Currently I'm exploring my way through all the new features added to the Visual Studio 2010 Beta 1 IDE and I found a feature that will hopefully be of great help to me. The UML Modeling tool in the Architecture Edition. I wanted to create a new test project, nothing special. I started out with creating just a standard UML Logical Class Diagram. Then after I had finished I wanted to export my diagram to C# code with class stubs but I couldn't figure out how to do it. So naturally I consulted MSDN, but I couldn't find any reference to the top down approach of design and sort of gave up on it. Then I happened to be on the Channel 9 website and I watch the Top down architecture video and they alluded to the possibility of Visual Studio 2010 being able to accomplish this task.
So I guess my question is, can Visual Studio 2010 take a Logical Class Diagram and generate code stubs from it?
I'm currently using Visual Studio 2010 Beta 1 Team System on Windows 7 (if that helps any).
Thank you
Try the following topics from the RC docs:
How to: Generate Files from a UML Model
From a UML model, you can generate program code, schemas, documents, resources, and other
artifacts of any kind. One convenient method of generating text files from a UML model is to use
text templates. These let you embed program code inside the text that you want to generate.
Customizing Your Model with Profiles and Stereotypes
You can adapt the standard UML model elements, such as classes and components, to customize them
for specific purposes. You can apply a stereotype to a model element that can change the element's
list of properties. Stereotypes are defined within collections called profiles.
You might also check out this blog post by Tim Fischer helps: "How To: Generate Code from Team System UML Diagrams in VS 2010 Team System Beta 2 (Update 4)"
Here is the first code-snippet about how to generate code from UML-Diagrams using T4 Text-Templates.
(source: msdn.com)
Here's another blog post by Oleg Sych: UML Modeling and Code Generation in Visual Studio 2010
Assuming that reader is already familiar with UML, it focuses on custom UML profiles - an
extensibility mechanism that can be used to tailor UML models to a particular problem
domain. Readers will see an example of such a profile, which extends UML Class Diagrams for
database modeling. Finally, the article shows how code can be generated from UML models using
T4 text templates.
I've posted more links on my profile for more info.
You answer is Visualization and Modeling Feature Pack. This pack gives your what ever you need regarding code generation from Visual Studio 2010 modeling facilities and more.
According to MSFT, the answer is no. Or at least, it is not built in by default though may be delivered by extension. See here

Categories