5

如何使用 TFS 2010 Power Tools 命令行实用程序 TFPT 在新 WorkItem 的描述字段中添加换行符?我试过这个:

Z:\>tfpt workitem /new "Project Ipsum\Issue" /collection:http://myserver:8080/tfs/test /fields:"Title=Testing Command Line 3;Description=Description of issue goes here<br /><br />I'd like to have line breaks too"

还有这个:

Z:\>tfpt workitem /new "Project Ipsum\Issue" /collection:http://myserver:8080/tfs/test /fields:"Title=Testing Command Line 3;Description=Description of issue goes here\r\nI'd like to have line breaks too"

无济于事。

有什么建议吗?

==============================

我实施的一种解决方法是创建一个新的(实际上是扩展的)工作项,其中包含我最初嵌入在长描述中的属性。所以,现在我将它们分解为单独的字段,例如:

Z:\>tfpt workitem /new "Project Ipsum\Issue" /collection:http://myserver:8080/tfs/test /fields:"Title=Testing Command Line 3;Description=Description of issue goes here;Field1=more info;Field2=even more data"

然后我创建了表单域(一个新的选项卡组)来显示它们。反正这样更干净。

确定如何使用 TFPT 添加换行符仍然很有趣。

谢谢。

4

3 回答 3

1

试试这个。在你的情况下:

    Z:\>set NLM=^
    Z:\>set NL=^^^%NLM%%NLM%^%NLM%%NLM%
    Z:\>tfpt workitem /new "Project Ipsum\Issue" /collection:http://myserver:8080/tfs/test /fields:"Title=Testing Command Line 3;Description=Description of issue goes here%NL%I'd like to have line breaks too"

更新:请参阅此链接。搜索 TobyKraft 的解决方案。他发现历史是 HTML 格式的。首先,您必须添加新的工作项,然后使用 <br> 标签使用 html 格式的字符串更新工作项历史记录。

于 2011-11-02T07:35:18.513 回答
1

我不知道如何帮助您使用 tfpt。
您可以构建一个使用 TFS-SDK 的小型控制台应用程序,并按如下方式完成工作:

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

namespace GenerateWorkItem
{
    class Program
    {
        static void Main(string[] args)
        {
            TfsTeamProjectCollection tpc = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://myserver:8080"));
            WorkItemStore workItemStore = (WorkItemStore)tpc.GetService(typeof(WorkItemStore));

            Project teamProject = workItemStore.Projects["Ipsum"];
            WorkItemType workItemType = teamProject.WorkItemTypes["Issue"];

            WorkItem Issue = new WorkItem(workItemType)
            {
                Title = "Testing Command Line 3",
                Description = "Description of issue goes here \n I'd like to have line breaks too"
            }
            ;
            Issue.Save();
        }
    }
}

这可以完成工作。现在,如果你让它依赖于你的string[] args,我希望@Ludwo 提出的方法应该是可用的。

以上基于

于 2011-11-03T16:14:36.603 回答
0

讨厌将此标记为已回答,但我确实添加了一个对我有用的解决方法。尽管我在我的 OP 中为我的问题添加了“解决方案”。这是为了清楚起见(感谢pantelif的概念)

我实施的一种解决方法是创建一个新的(实际上是扩展的)工作项,其中包含我最初嵌入在长描述中的属性。所以,现在我将它们分解为单独的字段,例如:

Z:\>tfpt workitem /new "Project Ipsum\Issue" /collection:http://myserver:8080/tfs/test /fields:"Title=Testing Command Line 3;Description=Description of issue goes here;Field1=more info;Field2=even more data"

然后我创建了表单域(一个新的选项卡组)来显示它们。反正这样更干净。

确定如何使用 TFPT 添加换行符仍然很有趣。

于 2011-11-03T16:52:52.263 回答