How do I add a line break in the description field of a new WorkItem using the TFS 2010 Power Tools command line utility TFPT? I've tried this:
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"
and this:
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"
to no avail.
Any suggestions out there?
============================
One workaround I have implemented is to create a new (actually extended) work item with properties that I was initially embedding in a long description. So, now I've broken them out into separate fields like:
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"
Then I created form fields (a new tab group) to display them. It's cleaner that way anyhow.
Still would be interesting to determine how to add line breaks with TFPT.
Thanks.
Try this. In your case:
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"
UPDATE: See this link. Search for TobyKraft's solution. He found that history is HTML formatted. First you have to add new workitem and then update workitem history with html formatted string using < br > tags.
I wouldn't know how to help you out using tfpt.
You could construct a small console application that uses TFS-SDK instead and get the job done as follows:
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();
}
}
}
This gets the job done.
Now if you make it depend on your string[] args
, I expect that the method @Ludwo presented shall be usable.
The above bases on this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With