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<https://github.com/grpc/grpc/blob/master/src/csharp/Grpc.Tools/ProtoCompile.cs#L414>

From: [email protected] <[email protected]> On Behalf Of 
[email protected]
Sent: Wednesday, April 3, 2019 1:41 AM
To: grpc.io <[email protected]>
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 
[email protected]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
Visit this group at 
https://groups.google.com/group/grpc-io<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fgroup%2Fgrpc-io&data=02%7C01%7Ccoverste%40microsoft.com%7C340cd34ea3834cab0b0e08d6b8101295%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C636898776515023046&sdata=Ana4FcSSXjAs9I6DjCI7Ap%2FKIPD0EVkWpJjgEdHifG0%3D&reserved=0>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/54a88d2e-fc8e-4156-868f-32ff8b8724eb%40googlegroups.com<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fgrpc-io%2F54a88d2e-fc8e-4156-868f-32ff8b8724eb%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=02%7C01%7Ccoverste%40microsoft.com%7C340cd34ea3834cab0b0e08d6b8101295%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C636898776515023046&sdata=Qriqwqw3OQQ9df5hpN%2F4g7t6XoDvE9D6m3McJH79lvM%3D&reserved=0>.
For more options, visit 
https://groups.google.com/d/optout<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Foptout&data=02%7C01%7Ccoverste%40microsoft.com%7C340cd34ea3834cab0b0e08d6b8101295%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C636898776515033040&sdata=UyNZeScwi22iwhJhN9FYfeNJGUq%2BhUrlWEkGYmyrn%2BU%3D&reserved=0>.

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/SN6PR2101MB1022F0D840ED4EC51D129DE3CE570%40SN6PR2101MB1022.namprd21.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to