简体   繁体   English

TFS C#-加载workItemStore返回null或键入初始化器异常

[英]TFS C# - Loading workItemStore returns null or type initializer exception

I am trying to load a TFS WorkItemStore through the following method (see below) which is returning a null value for the WorkItemStore. 我正在尝试通过以下方法(请参见下文)加载TFS WorkItemStore,该方法为WorkItemStore返回空值。

            TfsTeamProjectCollection teamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(tfsServer + "/" + collection));

            //Authenticate with current logged on user
            teamProjectCollection.Authenticate();

            //Setup store and project based on app config settings
            workItemStore = teamProjectCollection.GetService<WorkItemStore>();

I have also tried to load the WorkItemStore through the following, however this throws the exception: System.TypeInitializationException 我也尝试通过以下方式加载WorkItemStore,但这会引发异常:System.TypeInitializationException

            workItemStore = teamProjectCollection.GetService<WorkItemStore>();

Any help would be appreciated! 任何帮助,将不胜感激!

Thanks, 谢谢,

Chris 克里斯

It seems that there are some problems with loading type, perhaps this is due to mismatch versions of .Net used and which were assembly compiled. 加载类型似乎存在一些问题,这可能是由于所使用的.Net版本不匹配以及经过汇编编译导致的。 Here discussed this problem and ways to solve it. 这里讨论了这个问题及其解决方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM