0
votes

I installed the latest Google API package via NuGet Package Manager in VS2015 using Install-Package Google.Apis.Calendar.v3. However, my application refuses to build properly:

The primary reference "Google.Apis.Calendar.v3, Version=1.9.2.133, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the assembly "Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" which was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".

According to Using Google Calendar API V3 with .net framework 3.5, the Install-Package Google.Apis.Calendar.v3 command should automatically instruct the package to adapt to my .NET Framework v4.0 and C# 3.0. Why does it fail to do that here?

1
Sounds like the problem is with json.net. - Aaron
What ended up working for me was uninstalling all my packages, and subsequently reinstalling the Newtonsoft.Json and then the Calendar API packages. They ended up targeting the correct .NET 4.0 framework this way. - Spencer H

1 Answers

0
votes

The Calendar API probably targeted 4.0, but its dependency is still targeting 4.5.

You could try to use a binding redirect to target an older version of Newtonsoft.Json that still uses .NET 4.0, though that will only work if the signature of the methods the Calendar API uses has not changed at all between versions.