简体   繁体   English

使用 Visual Studio 2019 C# 的 gRPC 构建错误

[英]gRPC build error using Visual Studio 2019 C#

在此处输入图片说明

I make my project based on this tutorial:我根据本教程制作我的项目:

https://docs.microsoft.com/en-us/aspnet/core/tutorials/grpc/grpc-start?view=aspnetcore-3.1&tabs=visual-studio https://docs.microsoft.com/en-us/aspnet/core/tutorials/grpc/grpc-start?view=aspnetcore-3.1&tabs=visual-studio

It told me that it is missing directive or an assembly reference.它告诉我它缺少指令或程序集引用。 But I instal the related plugin, and the code generate successfully, I don't know why VS still can't find the code... Here is the code content, the namespace is exist:但是我安装了相关插件,代码生成成功,不知道为什么VS还是找不到代码……这里是代码内容,namespace是存在的:

在此处输入图片说明

More info my proto properties:更多信息我的原型属性: 在此处输入图片说明

Error Msg:错误消息:

1>MainWindow.xaml.cs(6,7,6,23): error CS0246: The type or namespace name 'HeartBeatMessage' could not be found (are you missing a using directive or an assembly reference?) 1>MainWindow.xaml.cs(16,24,16,40): error CS0246: The type or namespace name 'HeartBeatService' could not be found (are you missing a using directive or an assembly reference?) 1>MainWindow.xaml.cs(6,7,6,23):错误 CS0246:找不到类型或命名空间名称“HeartBeatMessage”(您是否缺少 using 指令或程序集引用?) 1>MainWindow.xaml .cs(16,24,16,40):错误 CS0246:找不到类型或命名空间名称“HeartBeatService”(您是否缺少 using 指令或程序集引用?)

I found this question because I was running into this problem too.我发现这个问题是因为我也遇到了这个问题。 See: https://github.com/grpc/grpc/issues/20402参见: https : //github.com/grpc/grpc/issues/20402

For now, I have manually moved the generated .cs files into my project and disabled the build step on the .proto (otherwise VS will complain about double definitions).现在,我已经手动将生成的 .cs 文件移动到我的项目中并禁用了 .proto 上的构建步骤(否则 VS 会抱怨双重定义)。

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

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