Share via


Designing Templates

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Visual Studio templates used by the Guidance Automation Toolkit can be solution, project, or item templates. As you design your Guidance Packages, it is important to understand when you should use each kind of template.

Solution Templates

You should use solution templates to construct a new solution. The recipe associated with the solution template can collect template parameters and perform other setup operations. For example, you may need to create a configuration file that is placed in the Solution Items folder, where the content of the file is generated, using the names of projects as input parameters. The actions of the recipe are executed after the solution template is unfolded, so you can attach bound non-recurring references to solution elements to help the developer fine-tune the solution. For example, you can allow the developer to add optional solution elements, such as QuickStart code.

In general, it is better to have a number of solution templates corresponding to different solution structure options instead of giving the developer many recipes and templates to fine-tune one base solution.

Project Templates

You should use project templates to add new projects to an existing solution (by placing the project template in the Projects folder) or to include projects in a new solution (by placing the project template in the Projects subfolder of the Solutions folder).

To add a project to an existing solution, place the project’s template in the Templates\Projects solution folder of the Guidance Package Development solution.

To add a project to a solution template, place the project’s template in the Templates\Solutions\Projects solution folder of the Guidance Package Development solution.

If you need to use the same project template to add the project to an existing solution and to a new solution, place the template in both the Templates\Projects and Templates\Solutions\Projects folders.

Item Templates

You should use item templates to add items to existing projects or to projects when a new solution is created. However, in some cases, it may be easier to create new items by using the T4 library action in conjunction with the Add Item From String library action. For more information, see Common Actions.

Associating T4 Templates with Item Templates

You can associate T4 templates with a VS item template. The result is that the item expanded from the template is the result of unfolding the associated T4 template. An example is shown in Defining Item Templates.

See also

Design Principles | When to Use Bound and Unbound Recipes