Define Your Own Item Templates: C#: Build the Template Configuration File: Listing 2

You can control the behavior and UI for the Item Template by editing the vstemplate file. This code shows you the final version after it's been edited to include a better name, description, and class file name.

<VSTemplate Version="3.0.0" 
xmlns="http://schemas.microsoft.com/developer/
   vstemplate/2005" 
Type="Item">
  <TemplateData>
    <DefaultName>Wagner Copyright Class.cs</DefaultName>
    <Name>Wagner Copyright Class</Name>
    <Description>This template creates a default new
      class, and includes a copyright banner.
    </Description>
    <ProjectType>CSharp</ProjectType>
    <SortOrder>10</SortOrder>
    <Icon>__TemplateIcon.ico</Icon>
  </TemplateData>
  <TemplateContent>
    <References>
      <Reference>
        <Assembly>System</Assembly>
      </Reference>
      <Reference>
        <Assembly>System.Core</Assembly>
      </Reference>
      <Reference>
        <Assembly>System.Xml.Linq</Assembly>
      </Reference>
      <Reference>
        <Assembly>System.Data</Assembly>
      </Reference>
      <Reference>
        <Assembly>System.Xml</Assembly>
      </Reference>
      <Reference>
        <Assembly>mscorlib</Assembly>
      </Reference>
    </References>
    <ProjectItem SubType="Code" 
        TargetFileName="$fileinputname$.cs" 
        ReplaceParameters="true">Class1.cs</ProjectItem>
  </TemplateContent>
</VSTemplate>
comments powered by Disqus
Upcoming Events

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.