Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

121
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda