0
votes

I have problem with Google Calendar Api. Can't install Package Google.Apis, and Google.Apis.Auth, when Install-Package Google.Apis.Calendar.v3 works. Project in .net 4.0.

Install-Package : Unable to uninstall 'Microsoft.Bcl.Build 1.0.21' because 'Microsoft.Bcl 1.1.10' depends on it.
At line:1 char:1
+ Install-Package Google.Apis
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand


Install-Package : Could not install package 'Google.Apis.Core 1.13.1'. You are trying to install this package into a projec
t that targets '.NETFramework,Version=v4.0', but the package does not contain any assembly references or content files that
 are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package Google.Apis.Auth
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand


PM> Install-Package Google.Apis.Calendar.v3
'Google.Apis.Calendar.v3 1.13.1.509' already installed.

The primary reference "Google.Apis.Calendar.v3, Version=1.13.1.509, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "Google.Apis.Calendar.v3, Version=1.13.1.509, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".

1
This is meant to "just work", if you look at the dependencies of Google.Apis.Calendar.v3, it depends on an older version (v1.10.0) of Google.Apis for .net4Chris
I've just tested this with a fresh .net4 console app and it worked OK. Are you able to test with a fresh project with the same settings, and see if it works?Chris
Or have you manually added a dependency on Google.Api (or Google.Api.Core, or Google.Api.Auth, or...) v1.13.1? If so, this will need manually removing.Chris

1 Answers

2
votes

Upgrade your project to .Net framework 4.5 and it should work. The error message tells you exactly what the problem is.

Could not install package 'Google.Apis.Core 1.13.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', but the package does not contain any assembly references or content files that are compatible with that framework.

If you check the NuGet page Google APIs Core Client Library 1.13.1

The Google APIs Core Library contains the Google APIs HTTP layer, JSON support, Data-store, logging and so on.

Supported Platforms:

  • .NET Framework 4.5
  • Windows Store apps
  • Windows Phone 8 and 8.1
  • Portable Class Libraries

You will have to go back to 1.10 to find a version that supports Framework 4.0

Home of the Google .Net Client library on GitHub