Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

126
Views
Sharing one gRPC proto file for all solutions

I've recently got my hands on gRPC on .net core and so far I'm very pleased with it..

the only problem I have is the proto files, for example: If I make a change on MyProtos.proto file in my grpc server solution. i'll have to update MyProtos.proto files in all my client solutions..

so I was wondering if there are ways of sharing the proto files..

I've tried creating a separate solution and placing the proto files there then reference it to all other solutions but couldn't make it work.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can distribute proto files with nuget package. Use .nuspec file to pack the files. For example if you *.proto files are under proto folder My.Server.Proto.nuspec can look like this:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
  <metadata>
    <id>My.Server.Proto</id>
    <version>1.0.0</version>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>My Server Proto Files</description>
    <authors>My Company Ltd.</authors>
  </metadata>
  <files>
    <file src="proto/**/*.proto" />
  </files>
</package>

Then in the project where you want to consume the files install grpc dependencies

<ItemGroup>
  <PackageReference Include="Google.Protobuf" Version="3.14.0" />
  <PackageReference Include="Grpc.Tools" Version="2.34.0">
    <PrivateAssets>all</PrivateAssets>
    <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
  </PackageReference>
</ItemGroup>

Install your proto package:

<ItemGroup>
  <PackageReference Include="My.Server.Proto" Version="1.0.0" GeneratePathProperty="true" />
</ItemGroup>

Note the GeneratePathProperty="true". This will allow you to refer to nuget install folder. Now add Protobuf items

<ItemGroup>
  <Protobuf Include="$(PkgMy_Server_Proto)/proto/**/*.proto" ProtoRoot="$(PkgMy_Server_Proto)" GrpcServices="Client" />
</ItemGroup>

The $(PkgMy_Server_Proto) variable will be resolved to My.Server.Proto nuget folder. The variable name starts with Pkg and followed by package name when . replaced by _.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!