How to include proto files from one project in another project
See original GitHub issueI 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:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
please help
Hi folks, was there any resolution for this?