【发布时间】:2016-03-04 18:40:46
【问题描述】:
我正在尝试运行它,但控制台应用程序运行并关闭。
我猜查询是空白或空,但我确定有一个活动的工作项。
我只是想让它在这一点上拉回任何东西。
try
{
TfsTeamProjectCollection teamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://(server):8080/tfs/DefaultCollection"));
var workItemStore = (WorkItemStore)teamProjectCollection.GetService(typeof(WorkItemStore));
// Sample query string.
string wiqlQuery = "SELECT System.ID, System.Title from workitems ";
// Execute the query.
WorkItemCollection witCollection = workItemStore.Query(wiqlQuery);
// Show the ID and Title of each WorkItem returned from the query.
foreach (WorkItem workItem in witCollection)
{
Console.WriteLine("ID: {0}", workItem.Id);
Console.WriteLine("Title: {0}", workItem.Title);
Console.Read();
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
Console.Read();
}
【问题讨论】:
-
检查您已将项目设置为控制台应用程序而不是 Windows 应用程序。
-
我如何检查这个?当我转到属性时,输出显示控制台应用程序。
标签: c# asp.net api tfs visual-studio-2015