throwing error while creating UserCredential ;


I am getting the error as :

Could not load file or assembly 'System.Core, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

while executing the code for integrating google calendar in my web site using google API v3:

the code is:

     public bool connectCalendar()
            ClientSecrets secrets = new ClientSecrets
                ClientId = "",
                ClientSecret = "LxxxxxxxxxxxXYEb3Iaxo3C"
            CalendarService calendarConnection;                try
                UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(secrets, new string[]{
                    CalendarService.Scope.Calendar}, "user",
                    CancellationToken.None, new FileDataStore("Books.ListMyLibrary")).Result;
//exception is thrown in this line
                var initializer = new BaseClientService.Initializer();
                initializer.HttpClientInitializer = credential;
                initializer.ApplicationName = "secret-heaven-798";
                calendarConnection = new CalendarService(initializer);
            catch (Exception ex)
                return false;
            return true;

am referring this link, why am getting this error? what am doing wrong?

i had add these line to the web config file:

    <assemblyIdentity name="System.Core" PublicKeyToken="7cec85d7bea7798e" culture="neutral"/>
    <bindingRedirect oldVersion="" newVersion="" />
asked on Stack Overflow Dec 24, 2014 by (unknown user) • edited Dec 25, 2014 by (unknown user)

1 Answer


One of components of your solution is dependent on System.Core, Version= This assembly should be in bin directory of you solution (I don't know is it web, or win or etc) or in the GAC. Most likely you don't have this assembly on your environment.

answered on Stack Overflow Dec 24, 2014 by IAfanasov

User contributions licensed under CC BY-SA 3.0