我无法从https://developers.google.com/drive/quickstart-cs编译源代码 [英] I can't compile the source code from https://developers.google.com/drive/quickstart-cs

查看:81
本文介绍了我无法从https://developers.google.com/drive/quickstart-cs编译源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法编译 https://developers.google.com/drive中的源代码/ quickstart-cs


<1> d:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ,27,22,49):error CS1502:'Google.Apis.Drive.v2.DriveService.DriveService(Google.Apis.Services.BaseClientService.Initializer)'的最佳重载方法匹配有一些无效参数。



<1> d:\ work \CSharp\ConsoleApplication1\Program.cs(22,44,22,48):错误CS1503:参数1:无法从Google转换。 Apis.Authentication.OAuth2.OAuth2Authenticator'to'Google.Apis.Services.BaseClientService.Initializer'


这两个错误引用了 var service = new DriveService(auth); string。任何想法?最近发布的.NET客户端库v1.3测试版引入了一些与后向不兼容的更改( http://google-api-dotnet-client.blogspot.com/2013/03/announcing-release-of-130-beta.html =nofollow> http:// google-api-dotnet-client .blogspot.com / 2013/03 /宣布 - 130-beta.html ),快速入门指南刚刚更新以反映更改。



要解决此问题,您必须更换此行:

  var service = new DriveService(auth); 

使用以下代码:

<$ p $新的BaseServiceClientService.Initializer()
{
Authenticator = auth
});

您还需要使用Google.Apis.Services添加; 到您的进口清单。


I can't compile the source code from https://developers.google.com/drive/quickstart-cs

1>d:\work\CSharp\ConsoleApplication1\Program.cs(22,27,22,49): error CS1502: The best overloaded method match for 'Google.Apis.Drive.v2.DriveService.DriveService(Google.Apis.Services.BaseClientService.Initializer)' has some invalid arguments

1>d:\work\CSharp\ConsoleApplication1\Program.cs(22,44,22,48): error CS1503: Argument 1: cannot convert from 'Google.Apis.Authentication.OAuth2.OAuth2Authenticator' to 'Google.Apis.Services.BaseClientService.Initializer'

These two errors referenced with var service = new DriveService(auth); string. Any ideas?

解决方案

The recently released .NET client library v1.3 beta introduced some backward-incompatible changes (http://google-api-dotnet-client.blogspot.com/2013/03/announcing-release-of-130-beta.html), the quickstart guide has just been updated to reflect the changes.

To fix the issue you have to replace this line:

var service = new DriveService(auth);

With the following code:

var service = new DriveService(new BaseClientService.Initializer()
{
    Authenticator = auth
});

You will also need to add using Google.Apis.Services; to your list of imports.

这篇关于我无法从https://developers.google.com/drive/quickstart-cs编译源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆