Justin T. Watts
Justin T. Watts

Reputation: 565

Visual Studio 2013 Project Template

I'm trying to create a Visual Studio 2013 project template. The project I'm trying to create should include two other existing projects. Is it possible to automatically add those projects in the template? I've found some examples where this is possible but each attempt the projects are not included. I'm trying to include existing projects not other project templates.

One attempt has been this:

  <TemplateContent>
    <ItemGroup>
        <ProjectReference Include="..\..\Project.csproj">
            <Project>{E399177B-5518-41D9-9EE7-2033BAC85CA7}</Project>
            <Name>Existing Project</Name>
        </ProjectReference>
    </ItemGroup>
<Project TargetFileName="$safeprojectname$.csproj" File="CurrentProject.csproj" ReplaceParameters="true">
  <ProjectItem ReplaceParameters="true" TargetFileName="app.config">app.config</ProjectItem>
  ...
</Project>

Upvotes: 0

Views: 160

Answers (1)

Vincent
Vincent

Reputation: 1557

You need to create your project templates like you normally do and place these folders in the same root folder. Then in the root folder create a .vstemplate file, call it what ever you want. it should look a little bit like this:

<VSTemplate Version="2.0.0" Type="ProjectGroup"
    xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
    <TemplateData>
        <Name>Multi-Project Template Sample</Name>
        <Description>An example of a multi-project template</Description>
        <Icon>Icon.ico</Icon>
        <ProjectType>VisualBasic</ProjectType>
    </TemplateData>
    <TemplateContent>
        <ProjectCollection>
            <ProjectTemplateLink ProjectName="My Windows Application">
                WindowsApp\MyTemplate.vstemplate
            </ProjectTemplateLink>
            <ProjectTemplateLink ProjectName="My Class Library">
                ClassLib\MyTemplate.vstemplate
            </ProjectTemplateLink>
        </ProjectCollection>
    </TemplateContent>
</VSTemplate>

Then like you would do with with your normal project template, zip the files in the root folder by marking them all ➜ Right-click ➜ Send to ➜ Compressed (zipped) folder

you can create a project template for an existing project simply creating a normal .vstemplate file and configure it like you would for a template project this existing project does not need any parameters and it will be created exactly as it was.

I have used this blog to figure it out for my self

If you want the official msdn documentation.

Upvotes: 1

Related Questions