I was checking the official Microsoft docs regarding the usage of grpc services. I have downloaded their famous greeter service example and ran It successfully but the docs didn't explain how to regenerate the grpc classes after the proto files have been edited.
Is there a command I can use for this purpose? (Let's say I have added a new rpc method in my proto service definition, now how can make dotnet refresh the generated server code?)
Dotnet version I am using: v6 Edit: I prefer to use vs code and not vs, I mostly run dotnet commands through cli.
Details
I ran dotnet new grpc
command from my command prompt in order to generate a grpc template. It had a greet.proto
file in it by default. I edited it and added another rpc method to the Greeter
service
greet.proto
syntax = "proto3";
option csharp_namespace = "Auth";
import "google/protobuf/empty.proto";
package greet;
// The greeting service definition.
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (HelloReply);
rpc Test(google.protobuf.Empty) returns (HelloReply); // +++ I've added this here
}
// The request message containing the user's name.
message HelloRequest {
string name = 1;
}
// The response message containing the greetings.
message HelloReply {
string message = 1;
}
But when I want to implement the Test
method in the generated service file, I see the following error: C:\Users\masoum\source\progs\questify-community\questify-microservices\Auth\Services\GreeterService.cs (22,38): error CS0115: 'GreeterService.Test()': no suitable method