views:

37

answers:

1

The situation: I need to create about 40+ solutions that all reference 3 projects and have one project that is unique to each one. I'd like to create a multi-project template that does this, but from what I've read it looks like it's very difficult or impossible (related SO question, but doesn't answer).

I want my solution to look like this (names changed of course): These three are used by all solutions created under this "family":

  • MyCompany.Extensions
  • MyCompany.MyProject.Tests.Shared
  • MyCompany.MyProject.Scripts

This one is the one that makes the solution unique, 123, 124, 125 etc:

  • MyCompany.MyProject.Tests.Unit123

Is it possible to set up a multi-project template that will generate this structure?

References: MSDN Create Multi Project Templates

+1  A: 

Solution files are pretty simple text files. Open one with Notepad to have a look-see. You could easily write a little program that generates them.

Hans Passant
True. But in an ideal world I'd be able to make a template and make it availabe in visual studio... still, I see your point and I may go that direction.
jcollum
But saying a solution file is an xml document is not accurate. It's more like an INI file. And there's a lot of guids floating around in there...
jcollum
You are right, got mixed up with the project files. Nevertheless, it is a simple format. Use Guid.NewGuid() to create a GUID to write. The File + Export Template command doesn't support generating multi-project solutions.
Hans Passant
Looks like it could be a rabbit hole... some of those guid's look like they're specific to the project and some look like they may be global. Still, I think this is the only answer and I may go this direction. In the short term I settled for making a "template" solution that I copy to a different directory and rename namespaces accordingly. Clunky for sure, but doesn't require a new piece of code/utility that someone else may have to maintain in the future.
jcollum