在C#上使用Google.Apis客户端的问题

时间:2015-11-23 06:08:40

标签: c# google-api gtk# google-api-dotnet-client service-accounts

我正在为我的项目使用GTK#。在应用程序中,当我按下按钮并触发OnButton1Clicked函数时,它崩溃了。以下是代码。

protected void OnButton1Clicked (object sender, EventArgs e)
    {
        string serviceAccountEmail = "--------@api-project---------.iam.gserviceaccount.com";
        var certificate = new X509Certificate2(@"serviceAccountKey.p12", "notasecret", X509KeyStorageFlags.Exportable);

        ServiceAccountCredential credential = new ServiceAccountCredential(
            new ServiceAccountCredential.Initializer(serviceAccountEmail)
            {
                Scopes = new[] { AndroidPublisherService.Scope.Androidpublisher }
            }.FromCertificate(certificate)
        );
    }

这是错误信息。

Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeLoadException: Could not load type 'Google.Apis.Auth.OAuth2.ServiceAccountCredential' from assembly 'Google.Apis.Auth.PlatformServices, Version=1.9.3.19383, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab'.
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)

我已添加了Google.Apis包,并且已完全更新。enter image description here

没有任何软件包,我只是添加了Google.Apis以及由于依赖项而安装的所有内容。 我正在使用Xamarin Studio和MacOSX。 有人知道是什么导致了这个问题吗?

0 个答案:

没有答案