Coder Social home page Coder Social logo

C# client about chirpstack-api HOT 2 CLOSED

SchroterQuentin avatar SchroterQuentin commented on June 14, 2024
C# client

from chirpstack-api.

Comments (2)

SchroterQuentin avatar SchroterQuentin commented on June 14, 2024 2

If someone have the same issue, here come the solution :

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

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Grpc" Version="2.28.1" />

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

  <ItemGroup>
    <PackageReference Include="Google.Api.CommonProtos" Version="2.0.0" />

    <Protobuf Include="protobuf/as/**/*.proto" ProtoRoot="protobuf" OutputDir="protos.local/as/%(RelativePath)" GrpcServices="Client" CompileOutputs="false" />
    <Protobuf Update="protobuf/as/**/frameLog.proto;protobuf/as/**/profiles.proto;protobuf/as/**/integration.proto" GrpcServices="None" />
    <Protobuf Include="protobuf/common/**/*.proto" ProtoRoot="protobuf" OutputDir="protos.local/common/%(RelativePath)" GrpcServices="None" CompileOutputs="false" />
    <Protobuf Include="protobuf/geo/**/*.proto" ProtoRoot="protobuf" OutputDir="protos.local/geo/%(RelativePath)" GrpcServices="None" CompileOutputs="false" />
    <Protobuf Include="protobuf/gw/**/*.proto" ProtoRoot="protobuf" OutputDir="protos.local/gw/%(RelativePath)" GrpcServices="None" CompileOutputs="false" />
    <Protobuf Include="protobuf/nc/**/*.proto" ProtoRoot="protobuf" OutputDir="protos.local/nc/%(RelativePath)" GrpcServices="None" CompileOutputs="false" />
    <Protobuf Include="protobuf/ns/**/*.proto" ProtoRoot="protobuf" OutputDir="protos.local/ns/%(RelativePath)" GrpcServices="None" CompileOutputs="false" />
  </ItemGroup>
</Project>

It's important to not generate the C# objects for the google's proto but include them in the tree and reference the Google.Api.CommonProtos as said here https://github.com/googleapis/api-common-protos#packages

from chirpstack-api.

SchroterQuentin avatar SchroterQuentin commented on June 14, 2024

An exemple of my project :

Chirpstack.Client.csproj

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

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Google.Api.CommonProtos" Version="2.0.0" />
    <PackageReference Include="Grpc" Version="2.28.1" />

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

  <ItemGroup>
    <Protobuf Include="protobuf/**/*.proto" ProtoRoot="protobuf" OutputDir="protos.local/%(RelativePath)" CompileOutputs="Both" />
  </ItemGroup>
</Project>

image

And the errors :

Google.Protobuf.Tools.targets(313,5): warning : Some expected protoc outputs were not generated.
protos.local/FrameLogGrpc.cs
protos.local/ProfilesGrpc.cs
...

protos.local/Http.cs(490,47): warning CS0436: The type 'HttpRule' in '***/ChirpStack.Client/protos.local/Http.cs' conflicts with the imported type 'HttpRule' in 'Google.Api.CommonProtos, Version=2.0.0.0, Culture=neutral, PublicKeyToken=3ec5ea7f18953e47'. Using the type defined in '***/ChirpStack.Client/protos.local/Http.cs'. [***/ChirpStack.Client/ChirpStack.Client.csproj]

protos.local/ServiceProfile.cs(733,25): error CS0234: The type or namespace name 'ServiceProfile' does not exist in the namespace 'Api'

Half of the errors maybe because of this grpc/grpc#17672

from chirpstack-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.