我正在尝试从 .proto 文件编译 GoogleCloudSpeechToTextv1p1beta1 的 C# 库 here . protobuf 编译器可以工作,只是它缺少 googleapis/google/protobuf 目录中的依赖项。它依赖的所有其他导入文件都存在,here .
我的问题是:为什么 googleapis/google directory 中缺少 protobuf 目录? ?它是我需要亲自编译/组装的库吗?还是 Google 应该提供的东西却没有提供?
最佳答案
google/protobuf
目录随 Google.Protobuf.Tools
包一起提供,在 tools
下(所以有 tools/google/protobuf/any.proto
例如)。或者,相同的文件位于 protobuf GitHub repo 中(在 src
下 - 原型(prototype)与 C++ 代码混合在一起)。
因此,如果需要,您应该将 tools
目录作为“根目录”包含在 protoc
调用中……但在这种特殊情况下,已经有一个 NuGet package of Google.Cloud.Speech.V1P1Beta1所以我建议你改用它 :)(如果你知道从其他 API 推断 URL 方案,甚至还有 docs available。它并不是真正的广告。)
关于c# - 缺少 googleapis/google/protobuf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51426784/