RE: [grpc-io] Includes between proto files in project

12 views
Skip to first unread message

Colin Versteeg

unread,
Apr 3, 2019, 12:30:56 PM4/3/19
to alej...@theengineering.company, grpc.io

You can pass a proto root to the build task – in your csproj:


<ItemGroup>

     <ProtoPath Include="../../submodules/protos/" />

    <ProtoPath Include="protos" />

  </ItemGroup>

<ItemGroup>
    <ProtoBuf Include="protos/service/hello_world_service.proto" ProtoRoot="@(ProtoPath)" />

  </ItemGroup>

 

There really isn’t much documentation around it (that I’m aware of), but you can see how the command line call is built here

 

From: grp...@googlegroups.com <grp...@googlegroups.com> On Behalf Of alej...@theengineering.company
Sent: Wednesday, April 3, 2019 1:41 AM
To: grpc.io <grp...@googlegroups.com>
Subject: [grpc-io] Includes between proto files in project

 

https://groups.google.com/forum/#!forum/grpc-io

 

I'm trying to use protobuf + GRPC in a Visual C# project (windows). It all works fine if my proto files (which are external references outside of the project) are self-contained (no imports) or reference any well-known protos. However, I'm struggling to add imports between proto files in my project.

 

In CLI, I can just use the -I= option to include my Bazel workspace path, but in VS I don't want to manually add pre-build steps for every file that imports other proto files in the project.

 

Is there any way to add an import directory to the internal build step performed by Grpc.Tools to generate C# code from the proto files? I couldn't find any information about it online.

--
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+u...@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/54a88d2e-fc8e-4156-868f-32ff8b8724eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages