开发者

Can a ProjectTemplate archive be stored within a Visual Studio solution, similar to the way CodeTemplates (.tt) files work?

There are many blog posts out there that show you how to create and include T4 (Text Template Transformation Toolkit) files (.tt) in your solution and have them override those stored in the default Visual Studio location. (see bottom of question for links)

Question:

Can you create and include a project Template file in a Visual Studio solution? If so what is required for Visual Studio to detect and use it.

A project template archive contains a .csproj, .vstemplate, an开发者_开发知识库d .cs files in them.

Example:

**ClassLibrary.zip**
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\CSharp\Windows\1033\ClassLibrary.zip

The .tt files seem to just work as soon as you add them, this doesn't seem to be the case for the template zip files...

Code Template Posts:

Hanselman - T4 Code Generation - Best Kept Visual Studio Secret

Conery - Make Visual Studio Generate Your Repository

Haack - Creating a Custom ASP.NET MVC Project Template


If you export the template using the wizard (File/Export Template) so you have a zipped up template package, then you can use a project with a post-build step to copy the template to the following location:

<userdir>\Documents\Visual Studio 2010\Templates\ProjectTemplates\<lang>

That location is read dynamically, so it should appear in VS next time you open the File/New project dialog.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜