开发者

TFS Version Control Item extensions

is it possible to extend a TFS Version Control Item with custom fields or properties? Most entries found are about custom properties on TFS Work Items.

I want to keep a version control Item linked to a record in a database, using a set of custom properties that contain the db/tabl开发者_运维百科e/primary key of the record.

Thanks, Rine


Team Foundation Server 2010 introduced a new feature called 'Properties'. Almost every item in TFS, be it a version control file/branch, or a work item can have a property bag associated with it.

What is missing from TFS 2010, is a generic UI to view/set these properties, however you can use the TFS Object Model to view/set them yourself.

For more information, see the following links:

  • Adding Properties to Artifacts within TFS 2010
  • Using the TFS Property Service to enrich your third party VS tools
  • MSDN documentation for Microsoft.TeamFoundation.Framework.Client.IPropertyService.


You delete a property by setting its value to null.

public static void DeleteGenericProperty( this IPropertyService propertyService, 
    string moniker, string propertyName, int version = 1 )
{
     var artifactSpec = new ArtifactSpec(ArtifactKinds.Generic, moniker, version);
     propertyService.SetProperty(artifactSpec, propertyName, (string) null);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜