© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•16mo ago•
1 reply
Skyhighjinks

gRPC Reusing protos between projects

So I currently have 2 projects within my solution, lets just call them
ServerP
ServerP
(Console app)
ClientP
ClientP
(.NET MAUI app)

I have got my proto definitions in the
ServerP
ServerP
project and everything is happy days with it, it compiles, recognises the compiled files etc...
The issue lies within
ClientP
ClientP
, although in the Solution Explorer I can see
Protos/ping.proto
Protos/ping.proto
which is very simple:

syntax = "proto3";

option csharp_namespace = "PProtos";

package ping;

service Pinger {
  rpc PingServer (PingRequest) returns (PingReply); 
}

message PingRequest {
  string name = 1;
}

message PingReply {
  int32 Itteration = 1;
}
syntax = "proto3";

option csharp_namespace = "PProtos";

package ping;

service Pinger {
  rpc PingServer (PingRequest) returns (PingReply); 
}

message PingRequest {
  string name = 1;
}

message PingReply {
  int32 Itteration = 1;
}


In
ClientP
ClientP
, I've set the Stub Classes to Client, and in ServerP I have got it set to Server


Inside of
ClientP.csproj
ClientP.csproj
I have the following line

<ItemGroup>
  <Protobuf Include="..\ServerP\Protos\ping.proto" Link="Protos\ping.proto" GrpcServices="Client" />
</ItemGroup>
<ItemGroup>
  <Protobuf Include="..\ServerP\Protos\ping.proto" Link="Protos\ping.proto" GrpcServices="Client" />
</ItemGroup>


And inside of
ServerP.csproj
ServerP.csproj
I have the following:
<ItemGroup>
  <Protobuf Include="Protos\ping.proto" GrpcServices="Server" />
</ItemGroup>
<ItemGroup>
  <Protobuf Include="Protos\ping.proto" GrpcServices="Server" />
</ItemGroup>


However, in ClientP, it doesn't seem to recognise the namespace nor generate the files within the
obj\Debug\net8.0-windows10.0.19041.0\win10-x64
obj\Debug\net8.0-windows10.0.19041.0\win10-x64
path (I am developing a windows app)

Relevant NuGet Packages installed (ClientP):
- Grpc.AspNetCore 2.66.0
- Grpc.Net.Client 2.66.0
- Grpc.Tools 2.67.0

Relevant NuGet Packages installed (ServerP):
- Grpc.AspNetCore 2.66.0
- Grpc.Net.Client 2.66.0
- Grpc.Tools 2.67.0

(I also have other things for ServerP such as EF/Serilog/DI packages etc but didnt think they were relevant)

If any other information is required please do let me know.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Referencing between Two Projects
C#CC# / help
3y ago
❔ Circular dependency between projects
C#CC# / help
3y ago
❔ Circular dependency between projects
C#CC# / help
3y ago
Reusing of types between GraphQL and Rest
C#CC# / help
2y ago