I need to add a gRPC server to an existing Windows service solution in Visual Studio, but the only way I can find is to create a separate project and transform it into a library. I also can’t add a proto file using the “add an element” menu, even with the gRPC core nugget installed.
To add a proto file, create a
.txt file, add proto information to it, then edit it. To have the ability to add proto files, change the project balise to
Sdk="Microsoft.NET.Sdk.Web" (this will add all the functions available for a new gRPC project).
To prevent having to copy the proto file when making a client, add a service reference and point it to the proto file of the server. This will ensure that any edits made to the server’s proto file will be synchronized.