Project, project, project, creating multi-project Solutions

Description

No extension today, sorry. When I saw this tip, while it's not code, I knew I had to share it.

I don't know about you, but when I spin up a new project, I usually use a common pattern for my projects, different layers, etc., also using a common set of libraries.

One of the great Visual Studio time savers are project templates. You've use them all the time, every time you File, New, Project. Did you can create your own project templates? You can take one of your existing projects and make it a template? How to: Create Project Templates

But what about multi-project solutions? Jayway's Elizabeth Andrews shares a tutorial on creating just that...

Visual Studio: How to create a solution template with multiple projects

After a while of creating the same solution structure code over and over again for the some kinds of projects I decided to make a template. Making a single project template was easy: you just follow along the Visual Studio export template wizard but making a solution template with multiple projects was not as simple, hence the reason for this blog post.

I’m using a PC with Windows 8.1 Pro and Visual Studio 2013 with update 4.

Setup Solution
First set up a solution with the projects you want to make into a template. For this example I’ll go with a really simple and stripped down skeleton for a backend solution following the domain driven design. You can fork it here. It’s just a really simple skeleton solution with multiple projects, feel free to go wild and crazy adding stuff and altering it as you like for your template.

This is what my demo project structure looks like

image

In order to make this into a Visual Studio template we need a .vstemplate file in the root as well as in each project we want to include in the final solution template. The easiest way is to use the template export wizard to export the projects one by one and then add the root template.

Export each project
Go to File ➜ Export Template…

...

image

...

[Click through to read the complete tutorial, Visual Studio: How to create a solution template with multiple projects]

For more information on creating Project and Item templates, check out Creating Visual Studio Templates.



Tag:

Coding4Fun

The Discussion

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.