从tfs

时间:2016-12-05 18:05:05

标签: c# tfs tfs-workitem

我试图通过使用C#从TFS查询工作项来生成/运行一些报告。

推荐this链接。这段代码工作了几个月,并且能够检索结果。

不确定为什么我会在第2行遇到异常

var tfsUrl = ConfigurationManager.AppSettings.Get("TfsCollection");
var uri = new Uri(tfsUrl);
var projCollection = TfsTeamProjectCollectionFactory
                            .GetTeamProjectCollection(uri);

//var workItemStore = projCollection.GetService<WorkItemStore>(); //Line 1

var workItemStore = new WorkItemStore(projCollection);  //Line 2

尝试过查询第1行等工作项目的其他方法,但没有运气。任何帮助都将受到高度赞赏。另外,有没有更好的方法使用C#查询TFS?

例外详情

  

类型&#39; System.ArgumentNullException&#39;的第一次偶然异常。发生在mscorlib.dll

     

附加信息:值不能为空。

System.ArgumentNullException occurred
_HResult=-2147467261
_message=Value cannot be null.    
HResult=-2147467261
IsTransient=false
Message=Value cannot be null.
Parameter name: value
  Source=mscorlib
  ParamName=value
  StackTrace:
       at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
  InnerException:

1 个答案:

答案 0 :(得分:1)

我的坏。在VS中启用此选项。

Debug -> Exceptions -> CLR exceptions

尽管例外,代码仍会执行。

相关问题