我可以使用Power Tools在Visual Studio中添加自定义工作项类型。
我需要自动化这个。 能够通过以下代码与TFS API进行交互。
Uri collectionUri = new Uri(txtPreview.Text);
NetworkCredential credential = new NetworkCredential(txtUserName.Text.Trim(), txtPassword.Text.Trim());
teamProjectCollection = new TfsTeamProjectCollection(collectionUri, credential);
teamProjectCollection.EnsureAuthenticated();
WorkItemStore workItemStore = teamProjectCollection.GetService<WorkItemStore>();
Query query = new Query(this.workItemStore,
" SELECT [System.Id], [System.WorkItemType]," +
" [System.State], [System.AssignedTo], [System.Title] " +
" FROM WorkItems Where [System.WorkItemType]='" + cmbTFSTypes.SelectedItem.ToString() + "'" +
"AND [System.TeamProject]='" + cmbProjects.SelectedItem.ToString() + "'" +
" ORDER BY [System.WorkItemType], [System.Id]"
);
WorkItemCollection workItemCollection = query.RunQuery();
能够从用户故事
等TFS工作项添加获取字段if(workItemStore.Projects[projectIndex].WorkItemTypes[cmbTFSTypes.SelectedIndex] != null)
{
foreach (FieldDefinition Fd in workItemStore.Projects[projectIndex].WorkItemTypes[cmbTFSTypes.SelectedIndex].FieldDefinitions)
{
}
}
从上面的代码允许我们访问字段列表。如果某个自定义字段显示“XId”不可用,则需要添加到TFS然后输入“用户故事”
请帮助。
答案 0 :(得分:3)
您可以使用witadmin命令行工具自动添加工作项类型。命令示例:
cd %programfiles(x86)%\Microsoft Visual Studio 14.0\Common7\IDE\
witadmin importwitd /collection:http://mytfs:8080/tfs/MyCollection /p:MyTFSProject /f:c:\foo\mycustomworkitemtype.xml
答案 1 :(得分:1)
你需要: