In order to add custom SharePoint site template we need to use SharePoint command line utility called stsadm with the following signature
stsadm –o addtemplate –filename template.stp –title templateTitle
This option allows for very flexible way of adding custom designed site templates. Once site template is added, you can use it with the Team Foundation Server’s process template.
It is very important to restart IIS Services after installing template by using iisreset command line or you may restart the server.
In order to specify site template we are planning to use in TFS we need to set XML Site element this way
<site template="" language=""/>
|template||Specifies which template to use. The template is a combination of the template name and configuration id from the webtemp.xml file on the SharePoint server.|
|language||Specifies a locale id to indicate which language version of the site template to use. The English version is 1033.|
Here is complete example of XML node
<task id="SharePointPortal" name="Create Sharepoint Portal" plugin="Microsoft.ProjectCreationWizard.Portal" completionMessage="Project site created.">
<site template="VSTS_MSFAgile" language="1033"/>…
After adding Site Template to Team Foundation Server, we need to add this template to our Process Template. In order to do that, we need to run command line to get all the names of all Site Templates for the final step of adding Site Template to our Process Template.
stsadm -o enumtemplates
For instance, the name of our Site Template is _MyTemplate_. We need to remember this information for our next and final step. Open up file called WSSTasks.xml from our TFS Process Template and modify following XML node in it
<site template="_MyTemplate_" language="1033"/>
Upload this Process Template back to our Team Foundation Server and we are done.