Visual Studio的模板 - 添加额外的预先存在的项目 [英] Visual Studio Templates - adding additional pre-existing projects

查看:204
本文介绍了Visual Studio的模板 - 添加额外的预先存在的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的地方生成的项目依靠大量引用,这恰好是源代码控制下的其他项目的一个Visual Studio模板。



问题是怎么做的我在ProjectGroup模板设置呢?举例来说,如果我有一个在已经存在的项目C:\Stuff\MyUtilityProject\Utility.csproj用一个文件(Tools.cs),我想要添加到我的模板,我将如何去了解这个?



下面就是我的vstempalte样子。仅供参考 - 我有刚加入预先存在的Utility.csproj到我的新的解决方案与ProjectTemplateLink或解决方案文件夹的创建,没有问题:提前



谢谢!

 < VSTemplate版本=2.0.0的xmlns =http://schemas.microsoft.com/developer/ vstemplate / 2005TYPE =ProjectGroup> 
< TemplateData>
<名称>&MySampleSolution LT; /名称>
<说明>我的测试项目与LT; /说明>
<项目类型>&CSHARP LT; /项目类型>
<图标和GT; __ TemplateIcon.ico< /图标>
< / TemplateData>
< TemplateContent>
< ProjectCollection>
< SolutionFolder名称=内容>
<项目文件=C:\Stuff\MyUtilityProject\Utility.csproj>
<项目项> Tools.cs< /项目项>
< /项目>
< / SolutionFolder>
< ProjectTemplateLink项目名=MyWorkingTemplate>
MyWorkingTemplate\MyTemplate.vstemplate
< / ProjectTemplateLink>
< / ProjectCollection>
< / TemplateContent>
< / VSTemplate>


解决方案

您可以的举办自己的NuGet饲料(或使用的 TeamCity的或私人 MyGet 的饲料,然后你只需要的包您的公用事业项目作为一个包的NuGet 并把它添加到这里描述您的项目模板为: HTTP://docs.nuget。组织/文档/参考/包,在视觉工作室模板


I'm working on a Visual Studio template where the generated project relies on a number of references, which happen to be other projects under source control.

The question is how do I set this up in my ProjectGroup template? For example, if I have an already existing project at "C:\Stuff\MyUtilityProject\Utility.csproj" with a single file (Tools.cs) that I want to add to my template, how would I go about this?

Here's what my vstempalte looks like. FYI - I am having no issues with the ProjectTemplateLink or creation of the Solution folder, just in adding the pre-existing Utility.csproj to my new solution:

Thanks in advance!

<VSTemplate Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="ProjectGroup">
  <TemplateData>
    <Name>MySampleSolution</Name>
    <Description>My Test Project</Description>
    <ProjectType>CSharp</ProjectType>
    <Icon>__TemplateIcon.ico</Icon>
  </TemplateData>
  <TemplateContent>
        <ProjectCollection>
            <SolutionFolder Name="Content">
                <Project File="C:\Stuff\MyUtilityProject\Utility.csproj">
                    <ProjectItem>Tools.cs</ProjectItem>
                </Project>
            </SolutionFolder>
        <ProjectTemplateLink ProjectName="MyWorkingTemplate">
            MyWorkingTemplate\MyTemplate.vstemplate
        </ProjectTemplateLink>
        </ProjectCollection>
  </TemplateContent>
</VSTemplate>

解决方案

You could host your own NuGet feed (or use the NuGet capabilities of TeamCity or a private MyGet feed. Then you would just need to package your utility project as a NuGet package and add it to your project template as described here: http://docs.nuget.org/docs/reference/packages-in-visual-studio-templates

这篇关于Visual Studio的模板 - 添加额外的预先存在的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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