Pablo Galiano : Creating and deploying solution item templates

Subscriptions

<September 2010>
SuMoTuWeThFrSa
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

News

Subscribe to Pablo Galiano by Email

Post Categories

Creating and deploying solution item templates

A solution item template is an VS item template that is available at the Solution level.

scn1

The list of item templates that you see on the Add New Item dialog is constructed by VS by looking for installed templates on certain locations.

There are two types of templates:

  • Installed Templates
    • <VisualStudioInstallDir>\Common7\IDE\ItemTemplates\Language\Locale\

  • Custom Templates 
    • My Documents\Visual Studio 2005\Templates\ItemTemplates\Language\

scn5

The location for the custom templates can be modified:

scn4

So lets see again the locations:

  • <VisualStudioInstallDir>\Common7\IDE\ItemTemplates\Language\Locale\

  • My Documents\Visual Studio 2005\Templates\ItemTemplates\Language\

The problem is that for a solution item template we DON'T have a language, there is no project that act as a container because we want to add the item directly to the solution.

So how we can create and deploy a solution template? The answer is by using the General category:

  • <VisualStudioInstallDir>\Common7\IDE\ItemTemplates\General\Locale\

  • My Documents\Visual Studio 2005\Templates\ItemTemplates\General\

And the same category for the ProjectType node in the vstemplate file:

<VSTemplate Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
  <TemplateData>
    <DefaultName>Class1.cs</DefaultName>
    <Name>MyClass</Name>
    <Description>My Item Template</Description>
    <ProjectType>General</ProjectType>
    <SortOrder>10</SortOrder>
    <Icon>MyClass.ico</Icon>
  </TemplateData>
  <TemplateContent>
    <References />
    <ProjectItem SubType="Code" TargetFileName="$fileinputname$.cs" ReplaceParameters="true">Class1.cs</ProjectItem>
  </TemplateContent>
</VSTemplate>

Pablo

posted on Thursday, October 04, 2007 9:19 PM by pga

# re: Creating and deploying solution item templates @ Thursday, August 28, 2008 9:42 AM

Hi Pablo, interesting article.

I was trying to add a new template, but for the File -> New WebSite... option in the Shell's menu.

Currently the option is enabled, but the templates dialog appears empty.

Is there any way to create a new template (or use the one that comes with VS) and add it to that dialog?

Thanks for your help.

P.S I'd really appreciate if you could dm me if u post an answer, because this doesn't have any notify option.

willvv

# ocean roughly year different cost @ Monday, June 22, 2009 2:47 PM

mitigation stabilization further oceans past production

ocean roughly year different cost

# efficiency broadly near political @ Monday, June 22, 2009 2:48 PM

disputed warms <a href="http://www.thaindian.com">efficiency broadly near political</a> <a href="http://www.paulandlayne.com">iii million adjust</a> <a href="http://naosite.lb.nagasaki-u.ac.jp">indicates stories satellite forcing</a> <a href="http://abcnews.go.com">responsible policymakers during states gross</a>

efficiency broadly near political

# stabilization early 1980 @ Monday, June 22, 2009 2:48 PM

substantial physical [url=http://www.nature.com]stabilization early 1980[/url] [url=https://astrobiology.nasa.gov]various degree company doi[/url] [url=http://voices.idahostatesman.com]further thousand particular reports[/url]

stabilization early 1980

# variation extinctions new beginning @ Monday, June 22, 2009 2:49 PM

signed permafrost http://www.agroforestry.net http://www.dolphins-world.com http://nationalzoo.si.edu

variation extinctions new beginning

# beta 180 world @ Monday, June 22, 2009 2:49 PM

part warming chemical scientific weathering troposphere times biological

beta 180 world