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

C# 在C上使用Google.api客户端的问题#,c#,google-api,gtk#,google-api-dotnet-client,service-accounts,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 X

我在用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.api包,以及它的完全更新

没有任何软件包,我只是添加了Google.api和由于依赖关系而安装的所有东西。 我正在使用Xamarin Studio和MacOSX。
有人知道导致此问题的原因吗?

是否正确引用了所需的依赖项?错误表明无法加载依赖关系图中的某个类型。您可能需要添加Google.api.Auth.OAuth2,也可能需要添加Google.api.Services。我通常只使用nugget软件包