C# YouTube API 错误

问题描述 投票:0回答:1

当我想使用 YouTube API 编写代码时,我在命名空间中收到以下错误:

using Google.Apis.YouTube.v3;
using Google.Apis.YouTube.v3.Data;

错误 1 类型或命名空间名称“v3”不存在于 命名空间“Google.Apis.YouTube”(您是否缺少程序集 参考?)

错误 2 类型或命名空间名称“v3”不存在于 命名空间“Google.Apis.YouTube”(您是否缺少程序集 参考?)

这些“v3”标签似乎不存在,所以请帮助我。

c# .net youtube youtube-api
1个回答
2
投票

为了确保您拥有正确的库和依赖项,请尝试通过 NuGet 下载 Google.Apis.YouTube.v3 客户端库。这就是你要做的:

enter image description here

然后在控制台中输入

Install-Package Google.Apis.YouTube.v3
并按回车键。您应该看到类似这样的内容:

enter image description here

安装完成后,引用应该已添加到您打开的项目中,您所需要做的就是添加您的 using 语句:

using Google.Apis.YouTube.v3;
using Google.Apis.YouTube.v3.Data;
© www.soinside.com 2019 - 2024. All rights reserved.