gRPC Reusing protos between projects

So I currently have 2 projects within my solution, lets just call them ServerP (Console app) ClientP (.NET MAUI app) I have got my proto definitions in the ServerP project and everything is happy days with it, it compiles, recognises the compiled files etc... The issue lies within ClientP, although in the Solution Explorer I can see 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, I've set the Stub Classes to Client, and in ServerP I have got it set to Server Inside of 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 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 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.
1 Reply
Skyhighjinks
SkyhighjinksOP4w ago
Sometimes the IDE thinks it can find it, and then when I go to compile it freaks out
Want results from more Discord servers?
Add your server