使用带有换行符的TFPT命令行工具在TFS中创建新的WorkItem描述字段
如何使用TFS 2010 Power Tools命令行实用程序TFPT在新WorkItem的描述字段中添加换行符?我已经试过这样:使用带有换行符的TFPT命令行工具在TFS中创建新的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添加换行符仍然很有趣。
谢谢。
讨厌这个回答,但我确实添加了一个解决方法,为我工作。尽管我在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添加换行符仍然很有趣。
Try this。在你的情况下:
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"
更新:见this link。搜索TobyKraft的解决方案。他发现历史是HTML格式的。首先,您必须添加新的工作项目,然后使用HTML格式的字符串使用< br>标签更新工作项目历史记录。
可悲的是,这并没有奏效。我必须通过一个命令才能打电话给tfpt工作项目。 – beaudetious
我更新了我的答案;) – Ludwo
我看到说明字段被列为HTMLFieldControl。这就是为什么我假设
标签会起作用。但我认为他们将转换为>。
文本按原样显示在说明字段中。而History控件被列为一个WorkItemLogControl,它显然确实接受HTML标签。 –
beaudetious
我不知道如何帮助你使用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
,我期望@卢德介绍的方法应该是可用的。
以上基于this。
好吧,标记为您设计构建自己的答案没有任何问题。为了清楚起见,请考虑修改您的答案,以便描述您的技术解决方案。接受它,那就完全可以。 – pantelif