Build/Test Issues

grpc

Started by Dirk Maegh on 2,959 views

Hi,

a few days ago I started experimenting with grpc.

I have followed a tutorial online, and decided to play with it.
I have setup a project to compile my proto file, and it contains server and client code.
To make things as simple as possible, I have *only* added this single proto file, and compiled it. No Problem.

Until I got to look at ncrunch which seems to have difficulty compiling the project.

Here's the project:

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<None Remove="GreeterService.proto" />
</ItemGroup>

<ItemGroup>
<Protobuf Include="GreeterService.proto" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.18.0" />
<PackageReference Include="Grpc" Version="2.44.0" />
<PackageReference Include="Grpc.Net.Client" Version="2.43.0" />
<PackageReference Include="Grpc.Tools" Version="2.44.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>


And here's the single proto file: (GreeterService.proto)

syntax = "proto3";

service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply);
}

message HelloRequest {
string name = 1;
}

message HelloReply {
string message = 1;
}


NCrunch gives the following feedback:
Could not make proto path relative (0, 0): GreeterService.proto: No such file or directory

Could you find why ncrunch gives me that feedback ? Am I doing something wrong ?

Thx,
Dirk
Hi Dirk,

Thanks for posting.

This would be because the build item 'ProtoBuf' is a custom build item that isn't in NCrunch's auto inclusion list.

You should be able to solve this by adding the .proto files to NCrunch's additional files to include setting so that NCrunch copies them to the workspace it uses to build this project.
Hi Remco,

indeed that fixed it.

Thx for your swift solution,
Dirk

Post a reply

Log in to reply.