Search code examples
c#visual-studio-templates

Solution Folder not creating in VSTemplate ProjectCollection


I am using the below code to generate a new template. The issue is it is not creating the solution folder and adding projects in it.

<VSTemplate Version="3.0.0" Type="ProjectGroup" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
  <TemplateData>
<Name>DDD Framework</Name>
<Description>Domain Driven Design</Description>
<ProjectType>CSharp</ProjectType>
<ProjectSubType>
</ProjectSubType>
<SortOrder>1000</SortOrder>
<CreateNewFolder>true</CreateNewFolder>
<DefaultName>DDD_Framework</DefaultName>
<ProvideDefaultName>true</ProvideDefaultName>
<LocationField>Enabled</LocationField>
<EnableLocationBrowseButton>true</EnableLocationBrowseButton>
<Icon>Logo.png</Icon>
</TemplateData>
<TemplateContent>
<ProjectCollection>
  <SolutionFolder Name="01 Core">
    <ProjectTemplateLink ProjectName="$projectname$.Data">
      Data\MyTemplate.vstemplate
    </ProjectTemplateLink>
    <ProjectTemplateLink ProjectName="$projectname$.Objects">
      Objects\MyTemplate.vstemplate
    </ProjectTemplateLink>
  </SolutionFolder>
</ProjectCollection>

So, when new project is created with template, it is not creating solution folder 01 Core as mentioned <SolutionFolder Name="01 Core">


Solution

  • After some analysis and adding this tag <CreateInPlace>true</CreateInPlace> solution folders are creating and it finally works!!!

    <VSTemplate Version="3.0.0" Type="ProjectGroup" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
        <TemplateData>
             <CreateInPlace>true</CreateInPlace>
        </TemplateData>
    </VSTemplate>