2

I have a VS 2019 ASP.NET gRPC Server project. It has 2 proto files in the same folder:

Protos\mainsvc.proto
Protos\enums.proto

The enums.proto contains a declaration some of common enums which I'd like to use in multiple proto files. How can I import his enum.proto file to the mainsvc.proto? Now I have:

syntax = "proto3";
option csharp_namespace = "MyGrpcService";
package MyServer;
import "enums.proto"; // <- error: cannot find the file.
import "google/protobuf/timestamp.proto"; // <- its OK
ZedZip
  • 5,794
  • 15
  • 66
  • 119

1 Answers1

2

The paths to your imported proto files must be expressed as a relative path to the project (.csproj) file. In you example this means you should have (assuming the .csproj file is located in the parent directory to Protos):

import "Protos/enums.proto";

I believe this is specific to the ASP.NET gRPC tooling.

David Nordvall
  • 12,404
  • 6
  • 32
  • 52