Protoc command does not include "." as proto_path
I'm having an issue when building a protobuf
with protoc
from Rider. Not sure if it is a bug or a setting. This is how project files look like
<ItemGroup>
...
<Protobuf Include="data_service.proto"/>
...
</ItemGroup>
When I try to build from Rider protoc
fails as
File does not reside within any path specified using --proto_path (or -I). You must specify a --proto_path which encompasses this file
This is the protoc command
<HOME>/.nuget/packages/grpc.tools/2.67.0/tools/linux_x64/protoc --csharp_out=obj/Debug/net8.0 --plugin=protoc-gen-grpc=<HOME>/.nuget/packages/grpc.tools/2.67.0/tools/linux_x64/grpc_csharp_plugin --grpc_out=obj/Debug/net8.0 --proto_path=<HOME>/.nuget/packages/grpc.tools/2.67.0/build/native/include --dependency_out=obj/Debug/net8.0/da39a3ee5e6b4b0d_data_service.protodep --error_format=msvs data_service.proto
But I can build without issues from the command line with dotnet build
, where I can see it is using the following command
<HOME>/.nuget/packages/grpc.tools/2.67.0/tools/linux_x64/protoc --csharp_out=obj/Debug/net8.0 --plugin=protoc-gen-grpc=<HOME>/.nuget/packages/grpc.tools/2.67.0/tools/linux_x64/grpc_csharp_plugin --grpc_out=obj/Debug/net8.0 --proto_path=<HOME>/.nuget/packages/grpc.tools/2.67.0/build/native/include --proto_path=. --dependency_out=obj/Debug/net8.0/da39a3ee5e6b4b0d_data_service.protodep --error_format=msvs data_service.proto
What I can see is that, when running from command line, the --proto_path=.
is automatically added to the protoc
command, while this does not happen when building from Rider. In order to make Rider to build, I have to explicitly to add ProtoRoot
to the project file, E.g.
<ItemGroup>
...
<Protobuf Include="data_service.proto" ProtoRoot="."/>
...
</ItemGroup>
Any idea why? Adding ProtoRoot
is not really an option, because I don't own the project, I'm just depending on it.
I'm on ubuntu 22.0.4
Please sign in to leave a comment.
I found out that the issue was caused by opening the solution from a path containing a link to a folder. By opening the solution from the actual directory, I was able to build without issues!
Reporting a bug