views:

884

answers:

2

Hi,

I am trying to create a multi project template. I wish the sub projects names to contain the solution name. I have tried the following however $safeprojectName$ doesn't work in the root template for some reason. It tries to create the folders with $safeprojectName$ in the name rather than the actual project name.

<VSTemplate Version="2.0.0" Type="ProjectGroup"
  xmlns="http://schemas.microsoft.com/developer/vstemplate/2005"&gt;
  <TemplateData>
    <Name>Default Solution</Name>
    <Description>An example of a multi-project template</Description>
    <Icon>Icon.ico</Icon>
    <ProjectType>CSharp</ProjectType>
  </TemplateData>
  <TemplateContent>
    <ProjectCollection>
      <SolutionFolder Name="$safeprojectName$.Web">
        <ProjectTemplateLink ProjectName="$safeprojectName$.Web">
          Src\Web\MyTemplate.vstemplate
        </ProjectTemplateLink>
      </SolutionFolder>
    </ProjectCollection>
  </TemplateContent>
</VSTemplate>

I have done a lot of reading on this and have and have created an assembly using the IWizard interface that creates a parameter $solutionName$. I then used the following template.

<VSTemplate Version="2.0.0" Type="ProjectGroup"
  xmlns="http://schemas.microsoft.com/developer/vstemplate/2005"&gt;
  <TemplateData>
    <Name>Default Solution</Name>
    <Description>An example of a multi-project template</Description>
    <Icon>Icon.ico</Icon>
    <ProjectType>CSharp</ProjectType>
  </TemplateData>
  <TemplateContent>
    <ProjectCollection>
      <SolutionFolder Name="$solutionName$.Web">
        <ProjectTemplateLink ProjectName="$solutionName$.Web">
          Src\Web\MyTemplate.vstemplate
        </ProjectTemplateLink>
      </SolutionFolder>
    </ProjectCollection>
  </TemplateContent>
  <WizardExtension>
    <Assembly>DefaultSoloutionWizard, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=f753ddb61a28cb36, processorArchitecture=MSIL</Assembly>
    <FullClassName>DefaultSoloutionWizard.WizardImplementation</FullClassName>
  </WizardExtension>
</VSTemplate>

This however also fails with the same problem. I'm I trying to do the impossible? Any help on this would be most welcome.

A: 

You may want to look into the Guidance Automation Toolkit. There's a fair amount to digest there, but part of what it can do is put a Wizard-based UI on a multi-project template.

If you want to see an example of that, take a look at the Service Factory, which can create an entire solution structure based in part on a wizard.

John Saunders
+1  A: 

Did you figure this out? John Saunders' answer doesn't seem to point to anything specific.

No sorry I don't think it is possible. We gave up in the end.
Dominic Godin