如何:在 Visual Studio 2017 中创建项目模板 [英] How to: Create Item Templates in Visual Studio 2017

查看:36
本文介绍了如何:在 Visual Studio 2017 中创建项目模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何:在 Visual Studio 2017 中创建项目模板.在 VS 2015 中,文件菜单中有一个导出模板项目,可以从中创建项目或项目.此功能仍然可用还是只是移动了?谢谢

How to: Create Item Templates in Visual Studio 2017. In VS 2015 from the File menu there was an Export Templates item from which projects or item could be created. Is this feature still available or just moved? thx

推荐答案

正如上面 Guru Stron 所说,模板将导出到C:\Users\[UserName]\Documents\Visual Studio 2017\My Exported Templates" 文件夹作为 zip 文件.为了使用此模板,您必须将其移动或复制到以下文件夹... C:\Users\[UserName]\Documents\Visual Studio 2017\Templates\ProjectTemplates.此外,如果您想进一步定义模板在新建项目"对话框中的显示位置,则需要深入挖掘路径.

As stated by Guru Stron above, the template will be exported to the "C:\Users\[UserName]\Documents\Visual Studio 2017\My Exported Templates" folder as a zip file. In order to use this template, you will have to move or copy it to the following folder... C:\Users\[UserName]\Documents\Visual Studio 2017\Templates\ProjectTemplates. Additionally, if you want to further define where in the New Projects dialog box your template will appear, you will need to dig deeper in the path.

例如,如果您有一个用 C# 编写的 .NET 核心模板,您将希望将您的模板放在此路径中... C:\Users\[UserName]\Documents\Visual Studio 2017\Templates\ProjectTemplates\Visual C#\.NET 核心.当然,您可能需要添加最后一个文件夹(.NET Core).

For example, if you have a .NET core template written in C#, you will want to place your template in this path... C:\Users\[UserName]\Documents\Visual Studio 2017\Templates\ProjectTemplates\Visual C#\.NET Core. Of course, you may need to add the last folder (.NET Core).

最酷的一点是您可以为自己的组织创建模板集合,您可以将模板放置在一个路径中,例如... C:\Users\[UserName]\Documents\Visual Studio 2017\模板\ProjectTemplates\Visual C#\Daffitt Technologies\.NET Core.这看起来像这样:

The coolest thing about this is that you can create a collection of templates for your own organization, you could place the templates in a path such as... C:\Users\[UserName]\Documents\Visual Studio 2017\Templates\ProjectTemplates\Visual C#\Daffitt Technologies\.NET Core. This will look something like this:

需要注意的一点是,您可能需要对 zip 文件中包含的文件进行其他调整,尤其是 MyTemplate.vstemplate 文件.我注意到创建的项目模板并不总是产生我预期的结果.

One thing to note, is that there may be other tweaks you’ll have to do to the files contained in the zip file – particularly the MyTemplate.vstemplate file. I noticed that the created project templates don’t always create the results I expected.

这篇关于如何:在 Visual Studio 2017 中创建项目模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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