C# - Can I compile Proto 2 with compiler Proto 3

83 views
Skip to first unread message

Marina Karmely

unread,
Jun 2, 2019, 9:44:37 AM6/2/19
to Protocol Buffers
HI 

Is there some way to compile ptoto 2 with a compiler of proto 3 in VS 2019 for C#?
For example it can be done easily in Java(Eclipse and C++)

But with the latest version of protoc 3.8.0 when I try to compile proto 2 with compiler of proto 3 I have got the following exception "C# code generation only supports proto3 syntax"..

Do you have any advise?

Marc Gravell

unread,
Jun 2, 2019, 12:00:04 PM6/2/19
to Marina Karmely, Protocol Buffers
If it helps, protobuf-net's schema parser can do this. It is a slightly different API to the Google implementation, though.

You can test it online at https://protogen.marcgravell.com/ - or the command-line tool is available as a standalone utility via various mechanisms (the standalone command-line tool is more versatile than the online version, especially when processing multiple files).

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/0bc3b2c5-f604-432e-9ad9-c679e40f1455%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Derek Perez

unread,
Jun 2, 2019, 12:23:19 PM6/2/19
to Marc Gravell, Marina Karmely, Protocol Buffers
Yes it should be fine, just set syntax = "proto2" in your file, the compiler understands both I believe.

Marc Gravell

unread,
Jun 2, 2019, 12:54:54 PM6/2/19
to Derek Perez, Marina Karmely, Protocol Buffers
Unless it has been updated recently, then no - the "protoc"/Google C# implementation is (was?) proto3-only.

Marina Karmely

unread,
Jun 3, 2019, 3:36:53 AM6/3/19
to Derek Perez, Marc Gravell, 'Adam Cozzette' via Protocol Buffers
Thank you guys ! it was very helpful

On Sun, Jun 2, 2019 at 9:18 PM Derek Perez <de...@perez.earth> wrote:
Ok news to me. I was under the impression the compiler was agnostically backwards compatible but could be wrong. Also unsure for output language support outside the base support languages. 
Reply all
Reply to author
Forward
0 new messages