[C# .NET] How to parse .proto file and generate some boilerplate code

250 views
Skip to first unread message

Michael Powell

unread,
Oct 29, 2018, 9:35:40 PM10/29/18
to Protocol Buffers
Hello,

I'm a frequent participant in the OR-tools group, but here I have a Protobuf specific question, I think.

I'm looking for a way to parse a .proto file and generate some really boilerplate code from it. I might use a JSON or Xml sister file to further inform the generator, but the core bits of it are focused on the .proto file.

From a C#, or any other language, perspective, am I accurate in saying the Protobuf API is the way to do just this?

If possibly, I'm also wanting to generate at compile time using either Roslyn code generation, a custom build task, or what have you. The only rub there would be whether it fits with the Roslyn/MSBuild work flow.

Thanks in advance!

Best regards,

Michael Powell

Michael Powell

unread,
Oct 29, 2018, 9:49:43 PM10/29/18
to prot...@googlegroups.com
Short of leveraging the Protobuf API, I'm thinking of a Boost Spirit,
or similar, approach. But for this, I need to get my hands on the
*.proto language grammar itself.

> Thanks in advance!
>
> Best regards,
>
> Michael Powell
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "Protocol Buffers" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/protobuf/pueWYTikzxY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to protobuf+u...@googlegroups.com.
> To post to this group, send email to prot...@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages