I'm using dotnet standard 2.0 (Visual Studio 2017) for gRPC. This is how my whole project looks like:
Messages.proto
syntax = "proto3";
package Messages;
message IdRequest{
int32 id = 1;
}
message NameResponse{
string name=1;
}
Name.proto
syntax = "proto3";
package Services;
import public "proto/messages.proto";
service NameService{
rpc GetNameById(Messages.IdRequest) returns (Messages.NameResponse);
}
Common.proj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<None Remove="proto\messages.proto" />
<None Remove="proto\name.proto" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.10.1" />
<PackageReference Include="Grpc" Version="2.24.0" />
<PackageReference Include="Grpc.Core" Version="2.24.0" />
<PackageReference Include="Grpc.Tools" Version="2.24.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Protobuf Include="proto\messages.proto" />
<Protobuf Include="proto\name.proto" />
</ItemGroup>
</Project>
The project builds successfully however the final Common.dll has no Messages namespace and I cannot really reference IdRequest or NameResponse.
So where am I making the mistake that hides Messages namespace?