question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to include proto files from one project in another project

See original GitHub issue

I am not able to include protos present in Project A in a project B. The idea would be to have the protos with GrpcServices=“Server” in project A and in project B, of tests, include the same protos but, now, as GrpcServices=“Client”

ProjectA/Protos/Profile.proto

syntax = "proto3";

package profile;
option csharp_namespace = "ProjectA.Protos";
import "google/protobuf/empty.proto";

service ProfileService {
  rpc Get(google.protobuf.Empty) returns (Profile);
}

message Profile {
  string profile_id = 1;
  string description = 2;
}

ProjectA/Protos/User.proto

syntax = "proto3";

package user;
option csharp_namespace = "ProjectA.Protos";
import "google/protobuf/wrappers.proto";
import "Protos/Profile.proto";

service UserService {
  rpc Get(google.protobuf.StringValue) returns (UserDetail);
}

message UserDetail {
  string id = 1;
  string name = 2;
  repeated profile.Profile profiles = 7;
}

Project B .csproj (The test project)

<ItemGroup>
  <Protobuf Include="..\ProjectA\Protos\*.proto" GrpcServices="Client" ProtoRoot="Protos">
    <Link>Protos\*.proto</Link>
  </Protobuf>
</ItemGroup>

With these settings I always end up having this error return

error : File does not reside within any path specified using --proto_path (or -I). You must specify a --proto_path which encompasses this file. Note that the proto_path must be an exact prefix of the .proto file names -- protoc is too dumb to figure out when two paths (e.g. absolute and relative) are equivalent (it's harder than you think).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
wcabrera777commented, Jun 27, 2023

please help

0reactions
swayamrainacommented, May 24, 2023

Hi folks, was there any resolution for this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Importing .proto files from another project
You can do so by adding the ProtoRoot attribute to the <Protobuf /> section in your .csproj file. Let's say you have a...
Read more >
Include a multi-file protobuf package in a .NET Core project
Notice that even though the proto files are in the same folder, the import statement uses the path Protos/bar.proto , and not just...
Read more >
C# – Importing .proto files from another project
You can do so by adding the ProtoRoot attribute to the <Protobuf /> section in your .csproj file. Let's say you have a...
Read more >
Copying between projects or accounts
Copy screens/ containers to another project In Proto.io, you can copy project elements (screens, containers, and custom components) from...
Read more >
Import .proto files from another project - appsloveworld.com
In order to compile your proto, you should clone the dependency repos and set as include path in the protoc import, as example:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found