如果这听起来像一个简单的问题,请原谅我,但我感到困惑。
我有一个使用 Google Calendar v3 API 的Visual Basic应用程序,它已经完全运行了几个月。 身份验证全部正常运作等。
现在我想扩展项目的可用性,以包含联系详细信息。我最初发现了这个:
https://developers.google.com/google-apps/contacts/v3/#retrieving_a_single_contact
它提供了几个例子,尽管它们是C#。例如:
using Google.Contacts;
using Google.GData.Contacts;
using Google.GData.Client;
using Google.GData.Extensions;
// ...
RequestSettings settings = new RequestSettings("YOUR_APPLICATION_NAME");
// Add authorization token.
// ...
ContactsRequest cr = new ContactsRequest(settings);
// ...
在我的Visual Basic应用程序中,我改为使用此标题部分:
Imports System.Collections.Generic
Imports System.IO
Imports System.Threading
Imports System.Xml
Imports Google.Apis.Calendar.v3
Imports Google.Apis.Calendar.v3.Data
Imports Google.Apis.Calendar.v3.EventsResource
Imports Google.Apis.Services
Imports Google.Apis.Auth.OAuth2
Imports Google.Apis.Util.Store
我正在努力找到联系人组件。在我的NuGet打包器中,这是我目前安装的:
我试图找到 Google.Calendar 或 Google.Apis.Calendar ,但找不到它。自设置初始应用程序以使用Google.Calendar.v3以来已经过去了一年多。我忘记了哪些步骤?
感谢您对此的帮助!
更新 我遇到过这个网页:
https://www.nuget.org/packages/Google.GData.Contacts/
所以我想我会尝试在NuGet Package Console中执行命令,但结果如下:
Each package is licensed to you by its owner. NuGet is not responsible for, nor does it grant any licenses to, third-party packages. Some packages may include dependencies which are governed by additional licenses. Follow the package source (feed) URL to determine any dependencies.
Package Manager Console Host Version 3.4.3.855
Type 'get-help NuGet' to see all available NuGet commands.
PM> Install-Package Google.GData.Contacts
Attempting to gather dependency information for package 'Google.GData.Contacts.2.2.0' with respect to project 'CommunityTalks', targeting 'native,Version=v0.0'
Attempting to resolve dependencies for package 'Google.GData.Contacts.2.2.0' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Google.GData.Contacts.2.2.0'
Resolved actions to install package 'Google.GData.Contacts.2.2.0'
GET https://api.nuget.org/packages/newtonsoft.json.4.0.5.nupkg
OK https://api.nuget.org/packages/newtonsoft.json.4.0.5.nupkg 21ms
Installing Newtonsoft.Json 4.0.5.
Install failed. Rolling back...
Package 'Newtonsoft.Json.4.0.5' does not exist in project 'CommunityTalks'
Package 'Newtonsoft.Json.4.0.5' does not exist in folder 'D:\My Programs\CommunityTalks\packages'
Install-Package : Could not install package 'Newtonsoft.Json 4.0.5'. You are trying to install this package into a project that targets
'native,Version=v0.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.GData.Contacts
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
PM>
所以我不确定发生了什么。我是下载错误的东西还是什么。但我所知道的是,Google.Calendar.v3安装正常且可操作。
SUCCESS
看起来我可能会意外地解决这个问题:
在执行 PM 命令之前,我必须设置项目属性:
Install-Package Google.GData.Contacts
如果我提出错误的解决方案(或正确的解决方案,请告诉我。)