0

Google 캘린더 API를 사용하여 나 자신을 위해 작은 캘린더 앱을 만들려고합니다. 나는 이것을 위해 C#과 .NET을 사용하고있다. 기본적으로 내가 수행 한 모든 작업은 here 에서 예제 코드를 복사하고 FileDataStore 클래스를 에서 추가했습니다. 캘린더 용 API를 사용하도록 설정하고 NuGet을 통해 라이브러리를 설치하는 등 Google Developers Console에서 프로젝트를 만들었습니다. 그래서 내 코드는 이제 다음과 같습니다Google API를 사용하여 인증하려고 시도 할 때 mscorlib.dll에서 'System.AggregateException'이 (가) 발생했습니다.

using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using System.Windows.Forms; 

using Google; 
using Google.Apis.Auth.OAuth2; 
using Google.Apis.Calendar.v3; 
using Google.Apis.Calendar.v3.Data; 
using Google.Apis.Services; 

namespace calendar 
{ 
public partial class Form1 : Form 
{ 
    public Form1() 
    { 
     UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
      new ClientSecrets 
      { 
       ClientId = "here's my client id", 
       ClientSecret = "and the secret", 
      }, 
      new[] { CalendarService.Scope.Calendar }, 
      "user", 
      System.Threading.CancellationToken.None).Result; 

     // Create the service. 
     var service = new CalendarService(new BaseClientService.Initializer() 
     { 
      HttpClientInitializer = credential, 
      ApplicationName = "Calendar API Sample", 
     }); 
     InitializeComponent(); 
    } 
} 
} 

을하지만 그것을 만들려고 할 때 - 그것은 'System.AggregateException'와 충돌 처음에가 mscorlib.dll에서 발생 (UserCredential 자격 = ...) 선. 구체적 형식 'System.IO.FileNotFoundException'의 첫 번째 예외가 mscorlib.dll에서 발생

추가 정보 : Falied 파일 또는 어셈블리로드하는 (원래 : Не удалось загрузить файл или сборку)를 " Microsoft.Threading.Tasks.Extensions.Desktop, Version = 1.0.16.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a "또는 종속성 중 하나입니다. 지정된 파일을 찾을 수 없습니다 (원래 :.. либо одну из их зависимостей Не удается найти указанный файл)

이 예외에 대한 핸들러가있는 경우, 프로그램은 안전하게 계속 될 수 있습니다.

아마도 수정하기가 쉽지만 뭔가를 간과 한 것 같습니다. 그러나 나는 그것이 무엇인지 전혀 모릅니다. 당신은 나에게 무엇을 해야할지, 또는 문서를 어디서 볼 것인가를 말해 줄 수 있습니까?

UPD : 직접 수정 : NuGet에서 "Install-Package Microsoft.Bcl.Async -Version 1.0.166-beta -Pre"명령을 사용하여 Microsoft.Bcl.Async를 업데이트하면됩니다.

답변