如何使用引用在visual studio 2010中构建多项目模板

时间:2015-04-02 06:19:37

标签: visual-studio-2010

我正在尝试构建一个包含4个解决方案文件夹的visual studio模板,每个文件夹中包含多个项目,并且某些项目之间有引用。 我得做这个模板:

<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="ProjectGroup">
<TemplateData>
    <Name>My Template</Name>
    <Description>My multi-project template</Description>
    <ProjectType>CSharp</ProjectType>
    <ProjectSubType>
    </ProjectSubType>
    <SortOrder>1000</SortOrder>
    <CreateNewFolder>true</CreateNewFolder>
    <DefaultName>MyTemplate</DefaultName>
    <ProvideDefaultName>true</ProvideDefaultName>
    <LocationField>Enabled</LocationField>
    <EnableLocationBrowseButton>true</EnableLocationBrowseButton>
    <Icon>logo.jpg</Icon>
</TemplateData>
<TemplateContent>
<ProjectCollection>
    <SolutionFolder Name="Common">
        <ProjectTemplateLink ProjectName="$safeprojectname$.Common">ProjectName.Common\CommonTemplate.vstemplate</ProjectTemplateLink>
    </SolutionFolder>
    <SolutionFolder Name="Server">
        <ProjectTemplateLink ProjectName="$safeprojectname$.BL">Server\BLTemplate.vstemplate</ProjectTemplateLink>
        <ProjectTemplateLink ProjectName="$safeprojectname$.DAL">Server\DALTemplate.vstemplate</ProjectTemplateLink>
        <ProjectTemplateLink ProjectName="$safeprojectname$.DB">Server\DBTemplate.vstemplate</ProjectTemplateLink>
        <ProjectTemplateLink ProjectName="$safeprojectname$.External">Server\ExternalTemplate.vstemplate</ProjectTemplateLink>
        <ProjectTemplateLink ProjectName="$safeprojectname$.Implementation">Server\ImplementationTemplate.vstemplate</ProjectTemplateLink>
        <ProjectTemplateLink ProjectName="$safeprojectname$.Interface">Server\InterfaceTemplate.vstemplate</ProjectTemplateLink>
    </SolutionFolder>
    <SolutionFolder Name="Service">
        <ProjectTemplateLink ProjectName="$safeprojectname$.Service">Service\ServiceTemplate.vstemplate</ProjectTemplateLink>
    </SolutionFolder>
    <SolutionFolder Name="UI">
    <ProjectTemplateLink ProjectName="$safeprojectname$.App">UI\AppTemplate.vstemplate</ProjectTemplateLink>
        <ProjectTemplateLink ProjectName="$safeprojectname$.ServiceAgent">UI\MyTemplate.vstemplate</ProjectTemplateLink>
    </SolutionFolder>
</ProjectCollection>

但是当我尝试用这个模板创建一个新项目时,我只得到4个空文件夹......

1 个答案:

答案 0 :(得分:1)

您可以在此处找到此博客的解释和示例:

Creating an F# Solution Template for Visual Studio 2010

该博客的标题具有误导性,它实际上是创建任何模板的一个很好的解释。

希望这就是你所寻找的......