【发布时间】:2016-06-01 08:25:58
【问题描述】:
我在使用 Google 日历 API 时遇到问题。当 Install-Package Google.Apis.Calendar.v3 工作时,无法安装 Package Google.Apis 和 Google.Apis.Auth。 .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.
无法解析主要参考“Google.Apis.Calendar.v3, Version=1.13.1.509, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL”,因为它间接依赖于框架程序集“System. Net.Http,Version=1.5.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" 在当前目标框架中无法解决。 “.NETFramework,版本=v4.0”。要解决此问题,请删除引用“Google.Apis.Calendar.v3, Version=1.13.1.509, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL”或将您的应用程序重新定位到包含“System.Net”的框架版本.Http,版本=1.5.0.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a"。
【问题讨论】:
-
这意味着“正常工作”,如果您查看 Google.Apis.Calendar.v3 的依赖项,它依赖于 .net4 的 Google.Apis 的旧版本 (v1.10.0)
-
我刚刚用一个新的 .net4 控制台应用程序对此进行了测试,它工作正常。您是否可以使用具有相同设置的新项目进行测试,看看它是否有效?
-
或者您是否手动添加了对 Google.Api(或 Google.Api.Core,或 Google.Api.Auth,或...)v1.13.1 的依赖?如果是这样,这将需要手动删除。
标签: .net-4.0 google-api google-calendar-api nuget-package google-api-dotnet-client