Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
复制TFS 2015中的工作项_Tfs_Azure Devops_Tfs Workitem - Fatal编程技术网

复制TFS 2015中的工作项

复制TFS 2015中的工作项,tfs,azure-devops,tfs-workitem,Tfs,Azure Devops,Tfs Workitem,我们正在使用TFS 2015和CMMI过程模板 我试图找出如何从一个问题工作项创建一个完整副本,其中目标工作项类型应该是Requirement。 对于完整副本,我的意思是,应复制需求中也可用的问题所有字段的值(例如标题、描述、状态、区域路径、迭代等),以及其他工作项(子项、父项、相关项、后续项、前置项等)的所有链接 在VSO中使用“复制”将不会复制问题(任务)的子链接。相反,它创建了一个与源问题相关的 任何关于如何实现的建议都将不胜感激。您可以使用从TFS读取测试用例,然后根据希望复制的属性创建

我们正在使用TFS 2015和CMMI过程模板

我试图找出如何从一个问题工作项创建一个完整副本,其中目标工作项类型应该是Requirement。 对于完整副本,我的意思是,应复制需求中也可用的问题所有字段的值(例如标题、描述、状态、区域路径、迭代等),以及其他工作项(子项、父项、相关项、后续项、前置项等)的所有链接

在VSO中使用“复制”将不会复制问题(任务)的子链接。相反,它创建了一个与源问题相关的

任何关于如何实现的建议都将不胜感激。

您可以使用从TFS读取测试用例,然后根据希望复制的属性创建新的测试用例。以下是一些示例代码:

使用系统;
使用Microsoft.TeamFoundation.Client;
使用Microsoft.TeamFoundation.WorkItemTracking.Client;
命名空间WorkItemTrackingSample
{
班级计划
{
静态void Main(字符串[]参数)
{//连接到服务器和存储,并获取WorkItemType对象
//用于创建用户故事的团队项目中的用户故事。
Uri collectionUri=(args.Length<1)?
新Uri(“http://server:port/vdir/DefaultCollection“”:新的Uri(args[0]);
TfsTeamProjectCollection tpc=新的TfsTeamProjectCollection(collectionUri);
WorkItemStore WorkItemStore=tpc.GetService();
Project teamProject=workItemStore.Projects[“DinnerNow”];
WorkItemType WorkItemType=teamProject.WorkItemTypes[“测试用例”];
//创建工作项。
WorkItem userStory=新的WorkItem(workItemType)
{
//标题通常是唯一没有默认值的必填字段。
//您必须设置它,否则无法保存工作项。如果您正在使用另一个
//工作项的类型,可能需要设置其他字段。
Title=“最近订购的菜单”,
描述=
“作为退货客户,我想查看我最近订购的商品。”
};
//保存新用户故事。
userStory.Save();
}
}
}
当您选择“创建工作项副本”时,VSO无法确定源工作项和目标工作项之间的关系,因此它只能在它们之间创建“相关”关系。复制工作项后,可以手动更新它。您还可以在“复制工作项”对话框中提交用于添加关系选择选项的

目前,自动执行此操作的方法是使用TFS API或VSO Rest API读取并记录有关源工作项的详细信息,更改所需信息(工作项类型、关系),然后基于新信息创建新工作项

   using System;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.WorkItemTracking.Client;

namespace WorkItemTrackingSample
{
    class Program
    {
        static void Main(string[] args)
        {            // Connect to the server and the store, and get the WorkItemType object
            // for user stories from the team project where the user story will be created. 
            Uri collectionUri = (args.Length < 1) ?
                new Uri("http://server:port/vdir/DefaultCollection") : new Uri(args[0]);
            TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(collectionUri);
            WorkItemStore workItemStore = tpc.GetService<WorkItemStore>();
            Project teamProject = workItemStore.Projects["DinnerNow"];
            WorkItemType workItemType = teamProject.WorkItemTypes["Test Case"];

            // Create the work item. 
            WorkItem userStory = new WorkItem(workItemType)
            {
                // The title is generally the only required field that doesn’t have a default value. 
                // You must set it, or you can’t save the work item. If you’re working with another
                // type of work item, there may be other fields that you’ll have to set.
                Title = "Recently ordered menu",
                Description =
                    "As a return customer, I want to see items that I've recently ordered."
            };

            // Save the new user story. 
            userStory.Save();
        }
    }
}