我一直在开发一个小型 winform c# 应用程序,它使我能够在 TFS 中创建一个工作项,而无需实际在 TFS 服务器上进行。我已经知道如何添加标题、附件、描述等。但是我似乎无法弄清楚如何将本地图像插入到 TFS 工作项“Repro Steps”字段中。到目前为止,这是我的代码。
Uri collectionUri = new Uri("Server Adress" + project);
TfsTeamProjectCollection server = new TfsTeamProjectCollection(collectionUri);
WorkItemStore store = (WorkItemStore)server.GetService(typeof(WorkItemStore));
WorkItem workItem = store.Projects[SubProject].WorkItemTypes["Bug"].NewWorkItem();
workItem.Title = "Title";
workItem.IterationPath = "Iteration";
workItem.AreaPath = "Area";
workItem.Fields["repro steps"].Value = "Text"; //Here is where I would like to add my image
workItem.Fields["Assigned To"].Value = "Assigned";
workItem.Attachments.Add(new Attachment(File, "comment"));
workItem.Save();
为了进一步澄清,这是我本质上想要做的事情: