多项目模板未显示在VS2015中 [英] Multi project template doesn't show up in VS2015

查看:84
本文介绍了多项目模板未显示在VS2015中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建多项目模板时,将其放入"Visual Studio 2015 \Templates \ProjectTemplates"中。路径,它永远不会在visual studio的新项目对话框中显示为选区。


我将两个组成项目分别导出为模板,将内容提取到文件夹,添加常用的.vstemplate将这些文件夹放在这两个文件夹之上,并将整个文件包含在.zip文件中。


单个项目模板显示正常,我不知道挂断的位置。


这是解决方案级别.vstemplate。


< VSTemplate Version =" 3.0.0"类型=" ProjectGroup"  

   的xmlns = QUOT; HTTP://schemas.microsoft.com/developer/vstemplate/2005">  

    < TemplateData>  

        <名称>&WebUITemplate LT; /名称>  

        <说明> Web UI解决方案< / Description>  

        < ProjectType> Web< / ProjectType>

   &NBSP;&NBSP;&NBSP;  < ProjectSubType> CSharp< / ProjectSubType>

   &NBSP;&NBSP;&NBSP;  < CreateNewFolder> true< / CreateNewFolder>

    < / TemplateData>  

    < TemplateContent>  

        < ProjectCollection>  

            < ProjectTemplateLink ProjectName =" $ safeprojectname $ .Web">  

                WebUITemplate \ MyTemplate.vstemplate 

            < / ProjectTemplateLink>  

            < ProjectTemplateLink ProjectName =" $ safeprojectname $ .Tests">  

                WebUITemplate.Tests \ MyTemplate.vstemplate 

            < / ProjectTemplateLink>  

        < / ProjectCollection>  

    < / TemplateContent>  

< / VSTemplate> 

解决方案

嗨Marbry,


欢迎来到MSDN论坛。


要创建多项目模板,请遵循以下文档:

如何:创建多项目模板


创建一个多-project template


  1. 创建要包含在多项目模板中的项目。
  2. 为每个项目创建.vstemplate文件。有关详细信息,请参阅
    如何:创建项目模板
  3. 创建一个根.vstemplate文件,该文件包含多项目模板的元数据。有关详细信息,请参阅下一节中的第一个示例。
  4. < span lang ="EN"style ="font-family:'Calibri',sans-serif; font-size:11pt">选择要包含在模板中的文件和文件夹,右键单击选择,单击
    发送至 ,然后点击
    压缩(压缩)文件夹 。文件和文件夹被压缩成.zip文件。
  5. 将.zip模板文件放在Visual Studio项目模板目录中。默认情况下,此目录为\ My Documents \Visual Studio
    版本 \Templates \ProjectTemplates \。


请注意以上步骤4,
选择所有文件,如root .vstemplate文件和文件夹(每个项目模板文件夹)并压缩成.zip确保这些文件和文件夹位于此.zip文件的根文件夹下,否则VS无法识别此自定义
模板。按照这些步骤在我的VS 2015中测试,它可以正常工作如下:





祝你好运,


萨拉


When I create a multi project template, and put it in the "Visual Studio 2015\Templates\ProjectTemplates" path, it never shows up as a selection in the new project dialog in visual studio.

I export both the constituent projects separately as templates, extract the contents to folders, add the common .vstemplate file above both those folders and include the whole mess in a .zip file.

Single project templates show up fine, I'm not sure where the hangup is though.

Here is the solution level .vstemplate.

<VSTemplate Version="3.0.0" Type="ProjectGroup"  
    xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">  
    <TemplateData>  
        <Name>WebUITemplate</Name>  
        <Description>Web UI solution</Description>  
        <ProjectType>Web</ProjectType>
        <ProjectSubType>CSharp</ProjectSubType>
        <CreateNewFolder>true</CreateNewFolder>
    </TemplateData>  
    <TemplateContent>  
        <ProjectCollection>  
            <ProjectTemplateLink ProjectName="$safeprojectname$.Web">  
                WebUITemplate\MyTemplate.vstemplate  
            </ProjectTemplateLink>  
            <ProjectTemplateLink ProjectName="$safeprojectname$.Tests">  
                WebUITemplate.Tests\MyTemplate.vstemplate  
            </ProjectTemplateLink>  
        </ProjectCollection>  
    </TemplateContent>  
</VSTemplate> 

解决方案

Hi Marbry,

Welcome to the MSDN forum.

To create a multi-project template, please follow this doc: How to: Create Multi-Project Templates

To create a multi-project template

  1. Create the projects to include in the multi-project template.
  2. Create .vstemplate files for every project. For more information, see How to: Create Project Templates.
  3. Create a root .vstemplate file that to contain the metadata for the multi-project template. For more information, see the first example in the following section.
  4. Select the files and folders to include in your template, right-click the selection, click Send To, and then click Compressed (zipped) Folder. The files and folders are compressed into a .zip file.
  5. Put the .zip template file in the Visual Studio project template directory. By default, this directory is \My Documents\Visual Studio Version\Templates\ProjectTemplates\.

Take care of this above step 4, select all the files like the root .vstemplate file and folders (each project template folder) and zip into a .zip file. Make sure those files and folders are under the root folder of this .zip file, otherwise the VS cannot recognize this custom template. Followed those steps and test in my VS 2015, it works fine as below:

Best regards,

Sara


这篇关于多项目模板未显示在VS2015中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆