Skip to main content
.NETStandard2.0

A libp2p implementation for .NET

Published
Sep 6, 2024
2y ago
Total Downloads
2.5K
2,508

Install

dotnet add package Nethermind.Libp2p.Generators.Protobuf --version 1.0.0-preview.30
ProductVersions
.NET Standard
netstandard2.0

README

Protobuf generator

The project automatically generates C# types for protobuf types using protoc(no need to install it separately, it's in the package).

Usage

  1. Add Google.Protobuf package
  2. Add Libp2p.Generators.Protobuf as analyzer dependency to you project
    ...
    <ItemGroup>
      ...
      <PackageReference Include="Libp2p.Generators.Protobuf" Version="3.25.1" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
    </ItemGroup>
    ...
    
  3. Make sure that Google.Protobuf version matches Libp2p.Generators.Protobuf project version
  4. Add a .proto file and set "Build Action" to "C# analyzer additional file" for it, "Copy to Output Directory"="Do not copy". It should look like <AdditionalFiles Include="Dto\Rpc.proto" CopyToOutputDirectory="Never" /> in csproj file.
  5. .cs file should be generated next to .proto one.

Additional notes

In case you want to use protobuf version that is more modern that is used by the generator, feel free to create an issue with request to update the version or just make a pr.

Changes from Previous Version

No structural changes between v1.0.0-preview.29 and v1.0.0-preview.30.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.