【问题标题】:Google drive compile warnings with 1.6 beta谷歌驱动编译警告与 1.6 测试版
【发布时间】:2013-12-01 12:51:46
【问题描述】:

我正在使用 Visual Studio 2012 (C#) 中 google drive 的代码。我花了几个小时摆弄 nuget 参考必要的库。

我编译了测试应用程序并收到以下警告:

'Google.Apis.Authentication.OAuth2.DotNetOpenAuth.NativeApplicationClient' is obsolete: 'NativeApplicationClient is not supported any more and it's going to be removed in 1.7.0-beta. Consider using the new Google.Apis.Auth NuGet package which supports .NET 4, .NET for WindowsStore apps, Windows Phone 7.5 and 8 and Portable Class Libraries as well'

'Google.Apis.Authentication.OAuth2.GoogleAuthenticationServer' is obsolete: 'GoogleAuthenticationServer is not supported any more and it's going to be removed in 1.7.0-beta. Consider using the new Google.Apis.Auth NuGet package which supports .NET 4, .NET for Windows Store apps, Windows Phone 7.5 and 8 and Portable Class Libraries as well'
'Google.Apis.Drive.v2.DriveService.Scopes' is obsolete: 'Use DriveService.Scope instead. This enum is going to be removed in version 1.7.0-beta.'

除了添加client_ID和client_secret之外,我没有修改代码。除此之外,它似乎在运行......

我还会提到我正在使用 nuget Google.Apis.Auth 包。

DriveService.Scopes 警告背后的代码使用的是 DriveService.Scopes 而不是 Google.Apis.DriveService.Scopes(查看链接上的代码;我的也是一样)。

随着 google admin api 被弃用,google 似乎几乎每隔一周就打破旧 api,我急于使用新的 API。但是,根据我在这里看到的情况,我想知道这是否是个好主意。我可以用煎锅换取火。话虽如此,如果您当前的示例已经过时,我们应该使用什么?

【问题讨论】:

    标签: google-api google-drive-api google-oauth google-api-dotnet-client


    【解决方案1】:

    首先,您应该使用最新版本的库,即我们维护的版本,提供修复、新功能等。您可以使用 NuGet 获取它。

    您提到的页面中的示例代码最近没有更新。查看我们的示例存储库(特别是 Drive API sample)。

    Google.Apis.Auth 是正确使用的包。旧包 (Google.Apis.Authentication) 过时的原因是我们希望支持不同的 Windows 平台,如 WP、Windows 8 应用程序、ASP.NET MVC。我们还简化了之前复杂的 OAuth2“舞蹈”。

    最后一件事 - 如果我们在库中进行任何不兼容的更改,我们会在我们的公告博客中记录它们,以便我们的用户能够做出正确的调整。我建议您订阅此博客以获取有关我们图书馆的更新。

    希望现在一切都清楚了:)

    【讨论】:

    • 谢谢;我会看看这个。您有使用新 API 添加用户的示例代码吗?
    • 我希望我之前能偶然发现上面的例子......编译起来要容易得多。
    • 我下载了整个示例并轻松编译。但是,我在我的 VS 2012 中运行它时仍然遇到问题。它会发送到谷歌,并且重定向 URL 会尝试返回到动态 URL。我尝试在我的 IDE 中强制该 URL 无济于事。你知道如何在 IDE 中强制端口吗?
    • 1) 您使用的是 Web 应用程序还是已安装的应用程序? 2) 你使用 ASP.NET MVC\ASP.NET\Console Application 吗?
    • 它是控制台应用程序,但是当我运行示例时,它会打开一个带有随机端口号的浏览器
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-10-23
    • 1970-01-01
    • 1970-01-01
    • 2018-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多