How to list the team projects created with a particular template in TFS 2008 or 2010

Buck Hodges

This question came up on an internal discussion, and I thought the answer would be useful to post.

Question

How we can find the list of projects created with the a particular VSTF template in TFS 2008 or 2010? In TFS 2005 we can find out programmatically as well with the query but in the new version we are not able to do so.

Answer

Sam Heald, a developer on the work item tracking server team, responded with the following answer.

This information is no longer stored automatically in TFS 2008 and newer.

In TFS 2005, a templateId was returned as an out parameter of the GetProjectProperties method on the ICommonStructureService interface.

However, this templateId might not point to the same template used during project creation for that project (deleted/overwritten templates are purged, ids are re-used). Additionally, most project attributes initialized by the project creation wizard (aka PCW) can be customized or changed after the fact.

In TFS 2008 or newer, the templateId parameter always returns -1.

If you wish to simulate the old functionality, you can modify your process templates to put the template name in the generic project properties property bag. In the properties element in the classification.xml, you can define name-value pairs to be created at project creation time, e.g.:

<property name=”TemplateName” value=”MSF Agile v4.0″ />

[UPDATE 2/26/2010] This post applies to TFS 2008 and TFS 2010 (and probably future releases).  I’ve updated the text to reflect that.

0 comments

Leave a comment

Feedback usabilla icon