I am getting a "File not found" error when using import in a .proto file. I am using Rider but have the same problem when using Visual Studio.
First proto File:
syntax = "proto3";
import "/fileToImport.proto";
service GreeterAPI {
rpc SayHello (SayHelloRequest) returns (SayHelloResponse);
}
message SayHelloRequest {
string name = 1;
}
message SayHelloResponse {
string answer = 1;
}
Second proto file that i want to import:
syntax = "proto3";
message Foo {
string bar = 1;
}
Both files are located next to each other in the project directory.
.csprjo File:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.10.1" />
<PackageReference Include="Grpc.Core" Version="2.25.0" />
<PackageReference Include="Grpc.Tools" Version="2.25.0" />
<Protobuf Include="**/*.proto" />
</ItemGroup>
</Project>
If i build the project without the import line everything is fine. But with the import line i get "File not found"
I know i can use the --proto_path
to tell protoc all the files.
But i don't want to build an extra pre-build script or something like that.
I want to use the build in support of the IDE.