Is there any way to get inheritance tree and/or class dependency graph for the whole Visual Studio project/solution from code? I know that it's possible to iterate through all classes and check keywords but I'm looking for easier way.
There is a Dependency graph feature in Visual Studio 2010. It is a new architecture tool available in VS2010.
The generated graph looks something like this,
Similar question
Dependency graph of Visual Studio projects
You can right click on your project and select View Class Diagram. Is that what looking for?
Visual Studio 2010 Ultimate can do this, using the Architecture functionality. In Professional/Express you can generate a class-diagram, but that's probably not what you want.
You can also used the tool NDepend to get a custom inheritance graph over a VS project, a VS solution or even multiple VS solutions. The graph would look like that:
Related
In Visual Studio 2012 Ultimate (and also 2010 and 2013), one can generate a dependency graph using ARCHITECTURE -> For Solution. I would like to access this functionality programmatically, perhaps using the Visual Studio SDK.
How can this be done?
P.S.
I'm aware of GraphCmd.exe. However, I need to be able to generate graphs for C/C++/C# projects and make certain modifications and calculations on said graphs.
EDIT:
I would specifically like to access the graph data structure produced by the dependency graph tool in VS.
It's there a plugin for visual studio or a specific program that allows to draw an UML model and generates the classes for C#?? and more, for example Creates a repository classes from classes entities of the entity framework generates
Visual Studio has had the Class Designer built in since Visual Studio 2005, though not all versions (the Express versions don't have it).
A former co-worker swore by http://www.sparxsystems.com.au/products/ea/index.html. The generated code definitely needed some tweaking though. Or something like http://staruml.sourceforge.net/en/index.php might have plugin's to generate needed c#...or perhaps t4.
In Visual Studio I have a lot of classes and UserControls that I have to move into another namespace. In eclipse I can do it with updating all the references automatically. In Visual Studio I couldn't find a similar function. How is this possbile in Visual Studio?
If you mean moving between assemblies:
For existing built code you should add:
[assembly:TypeForwardedTo(typeof(SomeNamespace.TheControl))]
to the original assembly (that no longer contains TheControl). Then the CLR will sort everything out for you for existing built code without having to update the references.
However, for building code you will still need to update the references; I don't think vanilla VS has that built in.
There's no such functionality provided in Visual Studio. Resharper has such feature.
Rename is supported in VS for reference update, but not file or class movements
I reccomend Resharper. It's really powerful refactoring tool fos VS. VS becomes even possible to use after installing it;) And it has tool for moving classes, methods, pulling up, pushing down, renaming and many more.
I'm using Visual Studio 2010 RC. Would it be possible that after doing my UML Diagrams, I could then generate classes with method stubs from it?
Thanks
Microsoft has stated that they intend to extend VS Architect edition to include code generation through the use of plugins but it is not available at this point.
http://social.msdn.microsoft.com/Forums/en-US/vsarch/thread/62eea855-af4a-4821-9843-3ef2377aebc2
Heres an article adding code generation to VS 2010 yourself:
http://www.olegsych.com/2010/01/uml-modeling-and-code-generation-in-visual-studio-2010/
Theres a plug in for VS here:
http://www.visual-paradigm.com/product/sde/vs/
Here are some standalone tools:
http://www.altova.com/umodel/uml-code-generation.html
http://www.tangiblearchitect.net/visual-studio/
Have you found the built-in class designer? Its pretty much UML compliant, and very easy to use.
Quick Start: Add a class, use View|Class View, richt-click the class and "Show in Diagram"
But no other diagram types.
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