Raghu's SharePoint Column : SharePoint - My Lifeline!!

Raghu's SharePoint Column

Template MetaData Files .VSTemplate extensions

To start with VSTemplate, lets first know where are VSTemplate files used.These files are used to create custom ItemTemplate and custom ProjectTemplate.Once these templates are created you can make it appear in the New New Item and the New Project dialog boxes.

1. ItemTemplates: All the templates that appear in the Add New Item Dialog Box are called Item Templates

2. ProjectTemplates: All the templates that appear in the Create/Add New Project Dialog Boxare called Project Templates

Before getting into creation of custom ItemTemplates, lets understand the structure of .VSTemplate which is the core part of Item and Project Templates

The .vstemplate file for project templates consists of three fundamental elements:

1. VSTemplate:  Identifies the template as a project or item template and provides the template version number. The attribute Type for VSTemplate specifies weather its project template or a Item Template

2. TemplateData: Categorizes the project template and defines   display characteristics for the New Project or Add New Item dialog box.It defines the name of the   tempalte,the description of what the template does, its default name and many other attritbute which we will  look into when we create a custom item template in the comnig posts



3. TemplateContent:Specifies the files included in the template.This part of the templates specifes what are the assembly references to be included, what are the default files need to be created when a new item is created usings this template


Apart from the above three fundamental there are other 2 optional sections, which may be needed during creation of custom templates

4. WizardExtension:This custom wizard helps to define additional custom functionality to the custom item templates, like adding the receiver class and the Recevice assembly into the feature dynamically


5. WizardData: This section of the VSTempalte helps us to pass custom xml to the custom wizard extension

Sample VSTemplate structure is shown below

<VSTemplate Version="2.0.0" Type="Item"
xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
<TemplateData>
<Name>Timer JobName>
<Description>Add a new timer jobDescription>
<ProjectType>CSharpProjectType>
<TemplateID>TimerJobTemplateID>
<ShowByDefault>trueShowByDefault>
<DefaultName>TimerJobDefaultName>
<Icon>Icon.icoIcon>
TemplateData>
<TemplateContent>
<References>
<Reference>
<Assembly>
System.Web, Version=2.0.0.0, Culture=neutral,
 PublicKeyToken=b03f5f7f11d50a3a
 Assembly>
Reference>
<Reference>
<Assembly>Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral,
 PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSILAssembly>
Reference>
References>
<Folder Name="FolderName">
<ProjectItem SubType="Code"
TargetFileName="feature.xml"
 ReplaceParameters="true">..\feature.xmlProjectItem>
 <ProjectItem SubType="Code"
TargetFileName="$rootname$.cs"
 ReplaceParameters="true">..\Job.csProjectItem>
 <ProjectItem SubType="Code"
TargetFileName="$rootname$Installer.cs"
 ReplaceParameters="true">..\JobInstaller.csProjectItem>
Folder>
TemplateContent>
<WizardExtension>
<Assembly>Wiz.CustomWizard, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=d24561bc194c5ab4, Custom=nullAssembly>
<FullClassName>Wiz.CustomWizard.CustWizardFullClassName>
</WizardExtension>
</VSTemplate>


 

 
Comments

No comments yet.

Leave a Reply
*

Protected by WP Anti Spam