简体   繁体   English

c# FirestoreDB Winforms - 无法访问 firebase?

[英]c# FirestoreDB Winforms - trouble getting access to firebase?

I'm trying to get access to my firebase Firestore however I am having issues and I'm not finding a lot of documentation on it.我正在尝试访问我的 firebase Firestore 但是我遇到了问题,我没有找到很多关于它的文档。 I have some experience using it with Android Studio however C# WinForms seems to be a different kind of beast in terms of getting started.我在 Android Studio 中使用它有一些经验,但是 C# WinForms 在入门方面似乎是另一种野兽。

Where I'm at:我在哪里:

  1. I've created a firestore project in firebase and created the collection: "Users" with one document in it.我在 firebase 中创建了一个 firestore 项目,并创建了集合:“用户”,其中包含一个文档。

  2. In my visual studio, I have installed Google.Cloud.Firestore.V1在我的视觉工作室中,我安装了Google.Cloud.Firestore.V1

  3. in my winforms file, I have this:在我的 winforms 文件中,我有这个:

 private void registerButton_Click(object sender, EventArgs e)
        {
            string projectId = "my-projectId-from-my-settings-on-Firebase";

            FirestoreDb db = FirestoreDb.Create(projectId);

            CollectionReference collectionReference = db.Collection("Users");

        }

I end up getting this error and I don't know why我最终得到了这个错误,我不知道为什么

System.IO.FileNotFoundException: 'Could not load file or assembly 'Google.Apis.Core, Version=1.44.1.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab' or one of its dependencies. The system cannot find the file specified.'

It breaks at this line: FirestoreDb db = FirestoreDb.Create(projectId);它在这一行中断: FirestoreDb db = FirestoreDb.Create(projectId);

I am trying to follow this page here: https://googleapis.github.io/google-cloud-dotnet/docs/Google.Cloud.Firestore/我想在这里关注这个页面: https://googleapis.github.io/google-cloud-dotnet/docs/Google.Cloud.Firestore/

I'm using a mac but I'm running visual studio in parallels for windows.我使用的是 Mac,但我正在为 windows 并行运行 Visual Studio。

There is tutorial on Firebase docs.有关于 Firebase 文档的教程 If you looked into it and it seems that you have to set up an environment variable for path to credential file.如果您查看它,似乎您必须为凭证文件的路径设置一个环境变量。

I would try to go through this "get started guide" before.我之前会尝试通过这个“入门指南”来 go。

I hope it will help!我希望它会有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM