我无法生成使用谷歌API的项目。我遵循 HTTPS构建指令:// code.google.com / P /谷歌API-dotnet的客户机/维基/建造。我得到几个错误这样的:
I'm unable to build a project that uses the Google APIs. I followed the build instructions at https://code.google.com/p/google-api-dotnet-client/wiki/Build. I get several errors like the following:
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来解决依赖关系,但我得到:
I also tried using NuGet to resolve dependencies, but I get:
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全部档案。我究竟做错了什么?
The documentation says the the 4.0 Full Profile is supported. What am I doing wrong?
我知道了现在的工作。我不完全知道什么固定它。
I've got it working now. I'm not exactly sure what fixed it.
我有一个老版本的NuGet安装在VS 2010年我可能最初安装它作为管理员,因为我不得不打开VS2010作为管理员删除它。取出的NuGet后,我安装了最新版本。我当时能够做包安装google.apis - pre
和包安装google.apis.authentication - pre
成功。但是,我的项目仍然不会编译。从我的记忆里,虽然我可能是错的,我做的唯一的事情是消除在同一个解决方案,从单独的项目中的谷歌API库引用,然后编译错误都不见了。
I had an old version of NuGet installed in VS 2010. I might have originally installed it as an administrator, because I had to open VS2010 as an administrator to remove it. After removing NuGet, I installed the latest version. I was then able to do package-install google.apis -pre
and package-install google.apis.authentication -pre
with success. But my project still wouldn't compile. From my memory, though I could be wrong, the only other thing that I did was remove the Google API Lib references from a separate project in the same solution, and then the compile errors were gone.