' Tweetinvi.TwitterCredentials'的类型初始值设定项当Autofac为3.3+时抛出异常

时间:2015-03-13 06:46:17

标签: exception credentials hashtag tweets tweetinvi

我想使用特定的主题标签从twitter检索推文。 我正在使用tweetinvi这个目的。但我收到一个错误 外部异常:

The type initializer for 'Tweetinvi.TwitterCredentials' threw an exception.
Inner exception:
{"Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)":"System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes"}
 i am using autofac 3.4.
kindly point out what am i doing wrong?

     TwitterCredentials.SetCredentials("useraccesstoken",
                "useraccessecret",
                "consumerKey",
                "consumerSecret");
              var searchParameterSearch.GenerateTweetSearchParameter("#pakvsSA");
           searchParameter.SetGeoCode(-122.398720, 37.781157, 1,DistanceMeasure.Miles);
           searchParameter.Lang = Language.English;
           searchParameter.SearchType = SearchResultType.Popular;
           searchParameter.MaximumNumberOfResults = 100;
           searchParameter.Until = new DateTime(2015, 12, 3);
           searchParameter.SinceId = 399616835892781056;
           searchParameter.MaxId = 405001488843284480;
           var tweets = Search.SearchTweets(searchParameter);

1 个答案:

答案 0 :(得分:0)

所以看起来Tweetinvi(Sytem.Core)需要一些缺少的.dll。

我强烈建议使用nuget将Tweetinvi作为软件包安装,因为它会自动安装并引用所有必需的dll。

https://www.nuget.org/packages/TweetinviAPI/