I would like to have a multi-project template that will create sub projects, and will install the nuget dependencies as well as have a vsix installer that will install this template.
Problems with methods already tried
Multi project template without VSIX, no nuget
I was able to create a multi project template, and it worked fine, except when it came time to including nuget references, it did not work. There was no easy/elegant support for nuget that did not involve VSIX.
Multi project template with VSIX, without a root template
So I tried using VSIX, and it seemed very straightforward. Add a template project as a zip or from solution, build the vsix installer. But when I added the second project template, to create a multi project template, built it, installed the template and tried to create a project I realised that it does not support a master-sub project setup, where a master project creates sub projects. This was a big problem because developers would have to create each project in dependency order.
I finally have the setup working. It took me many days of experimenting and patching together different MSDN articles and blogs to figure this out.
Combining Multi project template (with root template) and VSIX
The end result is
When creating a project with this template, it automatically creates multiple sub-projects, yet, the sub-projects are not (but can be) available as templates in the new project menu themselves. This is great if you are trying to template something like an enterprise design that is dependent on many projects working together, but you don’t want the user to be able to create these sub projects, or you want them to be available in a different project template area/category.
Steps:
Add the following to the file:
Open your first project you wish to use as a “sub project” template, export template from File->Export Template.
and paste in the following below the TemplateContent block (for example if you want to add a Json nuget package)
Zip up your entire root folder MyTemplate, so you end up with MyTemplate.zip which has the contents of the MyTemplate folder.
Optional Step to have your master project rename your files and namespaces