无法使用Google API(.Net)构建项目

时间:2013-07-23 15:53:26

标签: .net google-drive-api google-api-dotnet-client

我无法构建使用Google API的项目。我按照https://code.google.com/p/google-api-dotnet-client/wiki/Build的构建说明进行操作。我收到如下错误:

Warning 5   The primary reference "Google.Apis" 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" or retarget your application to a framework 
version which contains "System.Net.Http, Version=1.5.0.0, Culture=neutral, 
PublicKeyToken=b03f5f7f11d50a3a".   

我也尝试过使用NuGet来解决依赖关系,但我得到了:

Install failed. Rolling back...
Install-Package : Could not install package 'Zlib.Portable 1.9.2'. You are trying to install this package into a project that targe
ts '.NETFramework,Version=v4.0', but the package does not contain any assembly references that are compatible with that framework. 
For more information, contact the package author.
At line:1 char:16
+ install-package <<<<  google.apis -pre
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

文档说明支持4.0完整配置文件。我做错了什么?

2 个答案:

答案 0 :(得分:1)

我现在已经开始工作了。我不确定是什么解决了它。

我在VS 2010中安装了旧版本的NuGet。我原本可能以管理员身份安装它,因为我必须以管理员身份打开VS2010才能将其删除。删除NuGet后,我安装了最新版本。然后,我成功地完成了package-install google.apis -prepackage-install google.apis.authentication -pre。但我的项目仍然无法编译。从我的记忆中,虽然我可能是错的,但我做的唯一其他事情是从同一解决方案中的单独项目中删除Google API Lib引用,然后编译错误消失了。

答案 1 :(得分:0)

你需要安装 latest NuGet,这对我有帮助