GRPC C# - 众所周知的 grpc 类型存储在哪里以引用它们?无法导入 google.protobuf.Timestamp
GRPC C# - Where are the well known grpc types stored to reference them? Unable to import google.protobuf.Timestamp
我有一个非常简单的 protobuf 文件,如下所示
syntax = "proto3";
option csharp_namespace = "GrpcService1.Protos";
import "google/protobuf/timestamp.proto";
import "Protos/ReportingStatus.proto";
package GrpcService1;
service MetricReportingService {
rpc ReportMetricData(MetricMessage) returns (StatusMessage);
}
message MetricMessage {
int32 id = 1;
int32 value = 2;
google.protobuf.Timestamp last_updated = 3;
}
message StatusMessage {
ReportingStatus status = 1;
}
当我构建解决方案时出现以下错误
1>Protos/MetricProducer.proto(16,9): error : "google.protobuf.TimeStamp" is not defined.
我正在使用 Visual Studio 2019 版本 16.10.0。我添加了 Grpc.aspnetcore 元包。我试图查看众所周知的原型文件是否安装在其他地方,但不确定如何引用众所周知的原型类型。任何帮助将不胜感激。
改变
google.protobuf.TimeStamp last_updated = 3;
至
google.protobuf.Timestamp last_updated = 3;
听起来很奇怪,但重新启动 Visual Studio 并重建就成功了。也许我应该早点走开休息一下。 :-)
我有一个非常简单的 protobuf 文件,如下所示
syntax = "proto3";
option csharp_namespace = "GrpcService1.Protos";
import "google/protobuf/timestamp.proto";
import "Protos/ReportingStatus.proto";
package GrpcService1;
service MetricReportingService {
rpc ReportMetricData(MetricMessage) returns (StatusMessage);
}
message MetricMessage {
int32 id = 1;
int32 value = 2;
google.protobuf.Timestamp last_updated = 3;
}
message StatusMessage {
ReportingStatus status = 1;
}
当我构建解决方案时出现以下错误
1>Protos/MetricProducer.proto(16,9): error : "google.protobuf.TimeStamp" is not defined.
我正在使用 Visual Studio 2019 版本 16.10.0。我添加了 Grpc.aspnetcore 元包。我试图查看众所周知的原型文件是否安装在其他地方,但不确定如何引用众所周知的原型类型。任何帮助将不胜感激。
改变
google.protobuf.TimeStamp last_updated = 3;
至
google.protobuf.Timestamp last_updated = 3;
听起来很奇怪,但重新启动 Visual Studio 并重建就成功了。也许我应该早点走开休息一下。 :-)