C# plugin not generating *GRPC.cs file

1,384 views
Skip to first unread message

Alquin Cook

unread,
May 9, 2017, 6:50:47 AM5/9/17
to grpc.io
 am trying to generate grpc .cs files using a .bat file, but the messageGRPC.cs file does not get generated. However, the message.g.cs DOES get created. There are no errors and I even tried hard coding the paths and running the command window in administrator mode with the same results.

Again the message.g.cs does get generated correctly, but the messageGRPC.cs does not. I have set 


--grpc_out="%PROJ_ROOT%"\gRPC and --plugin=protoc-gen-grpc="%PLUGIN_DIR%"\grpc_csharp_plugin.exe


In my Visual Studio 2015 project I have installed Google.Protobuf, Google.Protobuf.Tools, Grpc, Grpc.Core, and Grpc.Tools from NuGet.

Is there anything I'm doing wrong?


@echo off
cd %~dp0

:: Display Current Working Directory used for debugging
:: echo Current Directory = %CD%

set PROJ_ROOT=%CD%        
set ROOT_DIR=%CD%

:: Display Solution Root Directory used for debugging
:: echo Root Directory = %ROOT_DIR%

:: Set path variables
set SRC_DIR=%ROOT_DIR%\Common\Messages

set PLUGIN_DIR=%ROOT_DIR%\<project>\packages\Grpc.Tools.1.3.0\tools\windows_x64

set DST_DIR=%ROOT_DIR%\Common\Messages\proto3

:: debugging
echo plug_in_dir = "%PLUGIN_DIR%"

echo Started compiling .proto messages using protoc version
"%PLUGIN_DIR%"\protoc.exe --version

:: code is on one line. it's wrapped here for readability
"%PLUGIN_DIR%"\protoc.exe -I "%SRC_DIR%" --proto_path="%SRC_DIR%" 
 --csharp_opt=file_extension=.g.cs --csharp_out="%DST_DIR%" "%SRC_DIR%"\message.proto 
 --grpc_out="%PROJ_ROOT%"\gRPC 
 --plugin=protoc-gen-grpc="%PLUGIN_DIR%"\grpc_csharp_plugin.exe  

cd %PROJ_ROOT%

echo Completed compiling .proto messages

Jan Tattermusch

unread,
May 9, 2017, 8:00:54 AM5/9/17
to Alquin Cook, grpc.io
Does your .proto file contain any service definitions (as opposed to just protobuf messages)? If not, no *Grpc.cs file should be generated (as there are no services that gRPC could use).

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/029bd1ea-d2c0-46df-8cff-6f2371b96664%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alquin Cook

unread,
May 9, 2017, 11:40:14 AM5/9/17
to grpc.io, alqui...@gmail.com
Thanks Jan. Yes, that was my problem. The tutorial I was following didn't have the service definition in the .proto file

To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages