TFS二次开发11——标签(Label)
2024-10-18 02:41:32
下图是在VS2010里创建Label的界面
可以看出创建Label 需要如下参数:Name、Comment、Path、Version 。
下面是代码实现:
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.VersionControl.Client; string tpcURL = "http://127.0.0.1:8080/";
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri(tpcURL));
VersionControlServer versionControl = tpc.GetService(typeof(VersionControlServer)) as VersionControlServer; //创建标签
string labelName = "标签名称";
string labelComment = "标签评论";
string path = "$/CRM/Branches/WeiMovie";
VersionSpec version = VersionSpec.Latest;
var versionControlLabel = new VersionControlLabel(versionControl, labelName, versionControl.AuthorizedUser, path, labelComment); //Represents one or more files or folders on the local machine or in the repository.
var itemSpec = new ItemSpec(path, RecursionType.Full);
var labelItemSpec = new LabelItemSpec[];
labelItemSpec[] = new LabelItemSpec(itemSpec, version, false);
var lb = versionControl.CreateLabel(versionControlLabel, labelItemSpec, LabelChildOption.Merge);
//查询标签
VersionControlLabel[] lbls = versionControl.QueryLabels(null, null, null, true);//查询全部标签
//VersionControlLabel[] lbls = version.QueryLabels(null, null, null, false, path, VersionSpec.Latest);// 查询指定路径的标签
//删除标签
versionControl.DeleteLabel(lbls[].Name, lbls[].Scope);
最新文章
- [ASP.NET]书店后台开发-模板页
- 如何预览github中的html页面
- C#自定义控件
- http://jingyan.baidu.com/article/86112f13582848273797879b.html
- Mac OS 快捷键
- 编译器失败,错误代码为xxx
- poj 2265 Bee Maja
- 基于Spring Boot构建的Spring MVC快速入门
- android编译系统的makefile文件Android.mk写法如下
- WCF技术剖析之二十七: 如何将一个服务发布成WSDL[基于WS-MEX的实现](提供模拟程序)
- 如何实现vue前端跨域,proxyTable解决开发环境前端跨域问题
- VS 使用vs2017自带的诊断工具(Diagnostic Tools)诊断程序的内存问题
- pythn print格式化输出---------";%s 和 % d"; 都是什么意思?
- Coroutine的原理以及实现
- 专访笨叔叔:2019年可能是Linux年?(转)
- Java代码优化小结(一)
- Nginx ACCESS阶段 统一的用户权限验证系统
- Leetcode 999. 车的可用捕获量
- ssm介绍
- Properties类、序列化流与反序列化流、打印流、commons-IO
热门文章
- Linux系统安装workerman,启动wss 服务
- 使用Ajax long polling实现简单的聊天程序
- css counter的使用方法
- python的输出问题
- zabbix添加对tomcat线程池的监控
- 【ArcGIS】ArcGIS Data Store配置
- scala函数demo
- windows命令行下用netsh实现端口转发(端口映射)
- TYAttributedLabel——简单,强大的iOS属性文本控件
- codeforces水题100道 第二题 Codeforces Beta Round #4 (Div. 2 Only) A. Watermelon (math)