코드에서 Associate Workitem을 보여주는 방법?
문제
XML 파일에 정보를 저장하는 내부 설계 도구를 사용하여 일부 제품을 개발합니다. TFS와 적절한 통합을 제공하기 위해 팀 탐색기와 상호 작용할 필요없이 디자이너를 사용하는 동안 사용자로부터 TFS, 체크인 및 체크 아웃 작업을 추적하는 공급자를 코딩했습니다.
이제 요구 사항은 파일을 확인할 때 관련 WorkItem을 추가하는 것이며, 일부 SDK 샘플을 중심으로 검색하고 탐색했지만 사용자가 코드를 연관시킬 수있는 동일한 Windows 양식을 표시 할 수있는 방법이 있는지 이해할 수 없었습니다. 코드에서 작업하거나 코드에서 전체 Windows 양식을 구현해야합니까 (WorkItems를 검색하고 검색하고, 연관시키고, 체크인을 수행하는 등). 두 솔루션 사이에 우리가 쓸 수있는 코드의 양에 대한 많은 차이가 있기 때문에 모든 정보에 감사 할 것입니다.
해결책 2
MS 컨설팅을 확인했으며 실제로 안전하지 않은 저수준 코드에 의지하지 않고 TFS 또는 Shell Extension이 사용하는 체크인 창을 표시 할 방법이 없습니다.
따라서 가능한 솔루션만이 TFS API를 사용하여 TFS 체크인 창을 모방하기 위해 새로운 C# 컨트롤/프로젝트를 작성하는 것입니다.
Massimo에 감사합니다
다른 팁
다음은 WorkItems를 업데이트하는 데 도움이되는 몇 가지 코드입니다. 또한 자세한 내용은 [이 링크] [1]을 사용해보십시오.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
namespace WorkItemTrackingSample2
{
class Program
{
static void Main(string[] args)
{
// Connect to the server and the store.
TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer("YourTfsServerNameHere");
WorkItemStore workItemStore = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));
// Get a specific WorkItem from the store.
// Replace "12345" with a WorkItem ID appropriate for testing.
WorkItem workItem = workItemStore.GetWorkItem(12345);
// Save the existing Priority so we can restore it later.
int oldPriority = (int)workItem.Fields["Priority"].Value;
// Set the Priority to an arbitrarily high number.
workItem.Fields["Priority"].Value = 9999;
// Display the results of this change.
if (workItem.IsDirty)
Console.WriteLine("The workItem has changed, but has not been saved.");
if (workItem.IsValid() == false)
Console.WriteLine("The workItem is not valid.");
if (workItem.Fields["Priority"].IsValid == false)
Console.WriteLine("The workItem's Priority field is not valid.");
// Tries to save the invalid WorkItem.
try
{
workItem.Save();
}
catch (ValidationException)
{
Console.WriteLine("The workItem threw a ValidationException.");
}
// Set the priority to a more reasonable number.
if (oldPriority == 1)
workItem.Fields["Priority"].Value = 2;
else
workItem.Fields["Priority"].Value = 1;
// If the WorkItem is valid, saves the changed WorkItem.
if (workItem.IsValid())
{
workItem.Save();
Console.WriteLine("The workItem saved this time.");
}
// Restore the WorkItem's Priority to its original value.
workItem.Fields["Priority"].Value = oldPriority;
workItem.Save();
}
}
}
[1]: http://msdn.microsoft.com/en-us/library/bb130323(VS.80).aspx
제휴하지 않습니다 StackOverflow