Visual Studio project generation - visual-studio-2013

Is there any way to auto generate visual studio projects with a, lets say, some kind of UML tool, so I can design project dependencies upfront and it will output the solution and its projects.
Bonus: I can do classical UML design (classes, interfaces, etc.) aswell
I'd appreciate any hint for any tool.

You could try GenMyModel. It lets you doing your model, writing and executing your own template generators directly from your browser.

Related

Nesting Projects

I see that MS has documentation on how to implement nesting projects when implementing new project types. While this looks do-able, I'd rather not write and maintain my own VS extension if I can avoid doing so. Is there any "generic" project type already implemented by some extension that will allow project nesting? The idea would be that the parent project does nothing but include its children and allow building, adding references, etc.
Managed Package Framework for Projects is for Visual Studio 2013 and includes "a project system that supports nesting" (see the NestedProject sample). I have not tried it myself, though I did look through it a while back (the VS 2010 version) and it has thorough documentation.
It may or may not be as extensive as what you are looking for. From the overview in the documentation:
Creating a new project type in Visual Studio is complex task. Using MPF_Proj is a good starting point for creating custom project types in Visual Studio written in managed code but there are limitations that would have to be considered before using the framework.
MPF_Proj is not a .NET library. It is rather a framework of source files (classes, utilities etc.) that can be included in a VSPackage project.

Visual Studio 2010 Ultimate Layer Diagram - Open Source Equivalent?

I really like the feature of having a dependency diagram and preventing certain assemblies from having references to other assemblies - ensuring other developers adhere to good programming practices.
Is there an open source equivolent of Visual Studio 2010 Ultimates Dependency Diagram? I checked out NDepend, however, this is for business use, so I cannot use the free version.
Edit: Perhaps I'm referring to the layer diagram? Whatever diagram that can be used to ensure certain assemblies do not have references to other assemblies
I.E.
Business assembly
Data assembly
Data.EntityFramework assembly
Data.EntityFramework implements interfaces from the Data assembly. The Business assembly only has a reference to the Data assembly, and has an instance from Data.EntityFramework via Unity or another IoC container.
I only have Visual Studio 2010 Professional :(
I haven't found anything that is a full equivalent of the layer diagrams in VS 2010.
ConQAT will let you visualize and analyze architectural conformance, but won't enforce rules at compile time like layer diagrams can. Also, ConQAT doesn't seem to work with VS 2010 solutions, which is a shame because it looks like it could be a very useful tool. It does support VS 2008 solutions.
Gendarme is the closest match to what you want, I think. This is a rule-based tool from the Mono team, and can be integrated into the IDE or your build server. So it will help you identify and enforce good programming practices, but it's not going to generate any diagrams for you.
Out of the box, Gendarme comes with lots of rules for catching bad practices (long methods, lack of cohesion, deep inheritance trees, etc.). You would have to write your own custom rules to enforce your specific architectural constraints - in your case by iterating through the assemblies and checking references.
The rules are written in C# - here's an example.

Reverse Engineering a C# Solution

I know Visual Studio 2010 Ultimate has some abilities, and I would normally do this by instinct, but I am on a very tight schedule. I also have Visio 2010 installed and integrated into VS, but its reverse engineer function doesn't seem to do much, and has to be run on a per project basis, and a hindrance here is the solution structure, with several solution folders each holding a multitude of projects.
I would like some advice on how to go about reverse engineering a C# solution into dependency diagrams, sequence diagrams and class diagrams.
If you use Visual Studio, the 2010 Ultimate edition supports 5 commonly-used UML diagrams (class , sequence , use case , activity , and component ). You can generate sequence diagrams and layer diagrams from code . If you also install the Visualization & Modeling Feature Pack with VS 2010 Ultimate, you can create UML class diagrams from code and generate code from UML class diagrams .
You can also explore existing code by using Architecture Explorer and visualize relationships in code by generating dependency graphs , which you can then also use to create layer diagrams.
As alternative, you can use Altova Usemodel or Sparx System's Enterprise Architect
since C# is using JIT compilation, an intermediate code is generated in compilation and there is a way to see that intermediate code.
reverse engineering in C#
This tip is from : http://www.devx.com/tips/Tip/30046
I am just pasting here. You should give credit to the original author if he is on StacOverflow
Open a window in VS.NET. Go to Project—>Visio UML—>Reverse Engineer. This automatically shows you the class diagrams with perfect relationships.
Note: This tip will work with VS.NET Version 1.0.0 and higher.

T4 code generation without Visual Studio 2010?

Is it possible to run T4 code generation without needing Visual Studio 2010? Basically I have to build an in house ORM (don't ask..if I had a choice I wouldn't). I was planning to use subsonic as a base but change some things and how they work. However my main question is can I run T4 from an external application that I write, so I can use the features of T4? Or am I better off doing it myself (which I doubt)?
TextTransform.exe will do what you want for simple scenarios:
http://msdn.microsoft.com/en-us/library/bb126245.aspx
Here is how to run a T4 template from your own code for templates created in VS 2010:
http://msdn.microsoft.com/en-us/library/ee844259(VS.100).aspx
And here is how to run a T4 template from your own code for templates created in VS 2008:
http://www.capprime.com/software_development_weblog/PermaLink,guid,104d9faf-5780-42ca-88e5-c04cb88f61b3.aspx
There will be some issues running Subsonic T4 templates outside Visual Studio:
How can I automate the t4 code generation for SubSonic
I would stick to T4 rather than roll your own template engine.
T4 is a part of Visual Studio. If your ORM tool can assume that Visual Studio is available, T4 is a good choice. You have an option of redistributing the Visual Studio shell, which also includes T4, with your application. Alternatively, you can use preprocessed templates to compile the templates into executable code generators. In compiled form, these templates don't require Visual Studio, but also cannot be modified.
Oleg
AFAIK T4 templates are invoked from within Visual Studio IDE.
Building an ORM needs more than text templates. I suggest you look into AtomWeaver (at http://www.atomweaver.com) which is a code generator that lets you build models from individual building blocks (called "Atoms"). These Atoms are smart templates that act both as text templates but also as mini-programs, allowing you to do much more that simple string substitution.
You can develop your own "Atoms" that transform a database structure into source code. Then, for each new database, you combine these Atoms to build your schema, and fire up the generator to obtain the source code. Because what you've built was actually a model of your DB, you can later make any changes and regenerate your code.
AtomWeaver implements ABSE, a kind of model-driven software development (has nothing to do with UML or MDA). Learn the mechanics of ABSE at http://www.abse.info
AtomWeaver is presently in public beta. There isn't much documentation at this point, so you may have a hard time getting up to speed with it.
There is a command line utility called TextTransform.exe you can use to generate code for a T4 template. I can't comment on if it is the right tool for building a ORM, but I like it well enough for generating state machines from an XML file.
http://msdn.microsoft.com/en-us/library/bb126245.aspx

Designing a Visual Studio 2010 Integration Package

I'd like to get started with the Visual Studio 2010 SDK and creating integration packages. All I would like to do for now is provide a new project type and language service. However, I don't know how I should design it...
The package will provide an editor for a programming language that compiles for x86 or ARM processors. The problem is that there are a few language differences depending on which processor you're developing for. I'd rather not have a separate project type for each architecture, however. Preferably, the programmer chooses the architecture when they create the project and the package automatically loads up the specific parts such as the correct language service, configuration settings, and whatever custom tools and dialogs are associated with that architecture.
How would I go about doing this? I've read about "flavored projects", but I don't really understand how to implement them. Is that what I need?
A couple of points to note to get you headed in the right direction:
The interfaces for a language service to hook into the editor have completely changed for VS 2010. I would recommended asking questions on the VS Editor Forum where all the devs for the core VS editor hang out for the speediest answers since the documentation and samples are still incomplete at this point. (There is a compatibility layer to support "old" language services, but you'd be better off just using the new interfaces since you're starting from scratch.)
A "flavored project" (referred to in the docs as a Project Subtype) is a way to add/remove functionality from an existing project system. For example, there is are project flavors for Web Projects, WPF, Devices, Database, etc.... on top of CSProj and VBProj. In these cases C# and VB are the "base" project systems and WPF, Web, Database are flavors that extend the base C#/VB project systems. Since you have a custom language, you should implement your own base project system. Your best bet for starting from scratch would be to build something based off the MPFProj source library.
I'm working on something very similar -- here is my starting point:
http://blogs.msdn.com/noahric/archive/2010/02/15/markdown-part-4-outlining.aspx
It's a very nice example of how to implement an editor extension.

Resources