The type initializer for 'Tweetinvi.TwitterCredentials' threw an exception while Autofac is 3.3+

0

i want to retrieve tweets from twitter using specific hashtags. i am using tweetinvi for this purpose.but i am getting an error outer exception:

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);
exception
credentials
hashtag
tweets
tweetinvi
asked on Stack Overflow Mar 13, 2015 by Azka Gilani • edited Mar 13, 2015 by Lucifer

1 Answer

0

So it looks like there are some .dll required by Tweetinvi (Sytem.Core) that are missing.

I would strongly advise using nuget to install Tweetinvi as a package as it will automatically install and reference all required dll.

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

answered on Stack Overflow Mar 23, 2015 by user2465083

User contributions licensed under CC BY-SA 3.0