【问题标题】:Unable to build project with Google APIs (.Net)无法使用 Google API (.Net) 构建项目
【发布时间】:2013-07-22 19:30:28
【问题描述】:

我无法构建使用 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 Full Profile。我做错了什么?

【问题讨论】:

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


【解决方案1】:

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

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

【讨论】:

    【解决方案2】:

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

    【讨论】:

    • 我安装了最新的 NuGet,也许他们解决了问题。
    猜你喜欢
    • 2012-08-07
    • 2019-09-28
    • 1970-01-01
    • 2015-05-08
    • 2018-01-31
    • 1970-01-01
    • 2013-05-06
    • 2017-12-19
    • 1970-01-01
    相关资源
    最近更新 更多