【问题标题】:UserCredential class from google apis not found未找到来自 google api 的 UserCredential 类
【发布时间】:2016-08-05 23:00:46
【问题描述】:

我正在使用 ms vs express 2012 win 桌面并尝试编译此代码示例https://developers.google.com/youtube/v3/code_samples/dotnet#upload_a_video

我得到了像 Google.Apis.YouTube.v3、Google.Apis.Authentication 和 Google APIs Client Library 这样的 nuget 包。现在我得到了几百个 dll,其中一些是重复的。

添加了以下参考

我的使用指令:

using System;
using System.IO;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;

using Google.Apis;

using Google.Apis.Authentication.OAuth2;
using Google.Apis.Authentication.OAuth2.DotNetOpenAuth;
using Google.Apis.Services;
using Google.Apis.Upload;
using Google.Apis.Util.Store;
using Google.Apis.YouTube;
using Google.Apis.YouTube.v3;
using Google.Apis.YouTube.v3.Data;

编译失败并出现以下错误:

找不到用户凭据(缺少 using 指令?)

GoogleWebAuthorizationBroker 不存在

GoogleClientSecrets 不存在

我需要什么参考或使用指令? GoogleWebAuthorizationBroker 似乎需要 Google.Apis.Auth.PlatformServices - 我有 Google.Apis.Authenication.PlatformServices 参考,没有帮助。

【问题讨论】:

  • 您是否在教程中的代码中添加了所有使用?
  • 从技术上讲,您只需要添加单个包,它会为您添加您需要的所有内容 PM> Install-Package Google.Apis.YouTube.v3
  • @DaImTo 是的,只是复制了所有内容。好吧,它下载了很多文件和文件夹,很多不同版本的同一个 dll,我添加了其中的几个,但看起来仍然缺少一些东西。 509 个不同的 dll 文件
  • 我觉得有些事情不应该下载那么多

标签: c# google-api youtube-api google-api-dotnet-client


【解决方案1】:

大约 3 年前,我们停止使用 DotNetOpenAuth 和 Google.Apis.Authentication(https://www.nuget.org/packages/Google.Apis.Authentication/ 已过时)。请注意,https://developers.google.com/youtube/v3/code_samples/dotnet#upload_a_video 中的示例实际上使用了正确的用法。

我建议你清理你的项目并重新安装 YouTube NuGet 包,它会为你安装所有正确的依赖项。

【讨论】:

    【解决方案2】:

    显然有些dll的版本不同,其中一些具有Google.Apis.Authentication结构,而另一些具有Google.Apis.Auth,因此您需要找到一个具有Auth和代码的会编译!

    【讨论】:

      猜你喜欢
      • 2013-05-11
      • 1970-01-01
      • 2016-09-30
      • 2013-08-28
      • 2021-07-08
      • 1970-01-01
      • 2016-10-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多