Announcement

Collapse
No announcement yet.

Protoc.exe generates code incompatible with Retyped.google-protobuf

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Protoc.exe generates code incompatible with Retyped.google-protobuf

    We downloaded the latest version of protoc from https://github.com/protocolbuffers/p...ses/tag/v3.6.1
    We created a bridge.net project and installed nuget package retyped.google.protobuf
    Wrote and compiled a .proto file:

    Person.proto
    syntax = "proto3";

    option csharp_namespace = "Google.Protobuf.Bridge";

    message Person {
    int32 id = 1;
    string name = 2;
    }

    Which compiled to
    ...
    using pb = global::Google.Protobuf;
    using pbc = global::Google.Protobuf.Collections;
    using pbr = global::Google.Protobuf.Reflection;
    using scg = global::System.Collections.Generic;
    namespace Google.Protobuf.Bridge {
    ...
    public sealed partial class Person : pb::IMessage<Person> {
    private static readonly pb::MessageParser<Person> _parser = new pb::MessageParser<Person>(() => new Person());
    ...

    It appears that the compiled code expects the Google.Protobuf nuget package to be included in the project. We included this nuget package and compiling the project resulted in 'missing mscorelib' errors.

    Is there another nuget package we are missing?

    Can someone post an example using Retyped.Google-protobuf?

    Thanks!

    #2
    Hi selinc,

    Since a Bridge project can have dependencies to Bridge libraries only, I don't think it will going to work.

    Retyped.google-protobuf was built as a binding package for JavaScript library:
    https://github.com/protocolbuffers/p...tree/master/js

    Unfortunately there is no much in the Protobuf JS documentation, but you can start with the following:
    1. Create a JavaScript/TypeScript project
    2. Install a NPM package containing Protobuf JS runtime
    3. Use a prebuilt JS Proto Compliler to produce js files for your proto definitions
    4. Include the generated js files into the project
    5. Create a Bridge project with Retyped.google-protobuf nuget package
    6. Specify JavaScript project's sub-folder as a output folder for files generated by Bridge

    This is how I see it could work, hope that helps.

    Comment


      #3
      Thanks for the response. We will attempt what you describe.

      Comment

      Working...
      X