Generating C# Code from Proto file into multiple code files not inline with file for each type, It should inline with file it imports

439 views
Skip to first unread message

venkatesu punugupati

unread,
Nov 15, 2016, 2:54:01 PM11/15/16
to Protocol Buffers
I am feeling that, there should be option to generate code files inline with proto file inclusion.
For example, B.proto imports A.proto then code generation should be into two files A.cs & B.cs.
is this type feature already available?

Feng Xiao

unread,
Nov 15, 2016, 3:44:43 PM11/15/16
to venkatesu punugupati, Protocol Buffers
There isn't such a feature. Both .proto files must be listed explicitly on the protoc command line.
 

--
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+unsubscribe@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.

venkatesu punugupati

unread,
Nov 15, 2016, 4:20:01 PM11/15/16
to Feng Xiao, Protocol Buffers
Thanks for the response..
Let me add more details to get clear..
A.proto , B.Proto are two proto files
B.proto imports A.proto then if generate the code then you will get B.cs containing all the types present A also in the same file.
But i like to have A.cs as separate file and B.cs as separate file but B.cs refers the types present in A.cs  

Please let me know if this is possible.


On Tue, Nov 15, 2016 at 3:44 PM, Feng Xiao <xiao...@google.com> wrote:



--
Regards,
Venkatesu Punugupati

Feng Xiao

unread,
Nov 15, 2016, 5:11:31 PM11/15/16
to venkatesu punugupati, Protocol Buffers
On Tue, Nov 15, 2016 at 1:19 PM, venkatesu punugupati <venkatesu....@gmail.com> wrote:
Thanks for the response..
Let me add more details to get clear..
A.proto , B.Proto are two proto files
B.proto imports A.proto then if generate the code then you will get B.cs containing all the types present A also in the same file.
What version of protobuf are you using? I believe protoc should already be putting classes in B.cs and A.cs separately.
 
But i like to have A.cs as separate file and B.cs as separate file but B.cs refers the types present in A.cs  

Please let me know if this is possible.

On Tue, Nov 15, 2016 at 3:44 PM, Feng Xiao <xiao...@google.com> wrote:
On Tue, Nov 15, 2016 at 11:51 AM, venkatesu punugupati <venkatesu....@gmail.com> wrote:
I am feeling that, there should be option to generate code files inline with proto file inclusion.
For example, B.proto imports A.proto then code generation should be into two files A.cs & B.cs.
is this type feature already available?
There isn't such a feature. Both .proto files must be listed explicitly on the protoc command line.
 

--
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+unsubscribe@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.




--
Regards,
Venkatesu Punugupati

venkatesu punugupati

unread,
Nov 15, 2016, 5:33:58 PM11/15/16
to Feng Xiao, Protocol Buffers
I am using 2..please let me know if it works in that way..

On Tue, Nov 15, 2016 at 5:11 PM Feng Xiao <xiao...@google.com> wrote:
On Tue, Nov 15, 2016 at 1:19 PM, venkatesu punugupati <venkatesu....@gmail.com> wrote:
Thanks for the response..
Let me add more details to get clear..
A.proto , B.Proto are two proto files
B.proto imports A.proto then if generate the code then you will get B.cs containing all the types present A also in the same file.
What version of protobuf are you using? I believe protoc should already be putting classes in B.cs and A.cs separately.
But i like to have A.cs as separate file and B.cs as separate file but B.cs refers the types present in A.cs  

Please let me know if this is possible.

On Tue, Nov 15, 2016 at 3:44 PM, Feng Xiao <xiao...@google.com> wrote:
On Tue, Nov 15, 2016 at 11:51 AM, venkatesu punugupati <venkatesu....@gmail.com> wrote:
I am feeling that, there should be option to generate code files inline with proto file inclusion.
For example, B.proto imports A.proto then code generation should be into two files A.cs & B.cs.
is this type feature already available?
There isn't such a feature. Both .proto files must be listed explicitly on the protoc command line.

--
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.
For more options, visit https://groups.google.com/d/optout.




--
Regards,
Venkatesu Punugupati

--
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.

Feng Xiao

unread,
Nov 15, 2016, 5:34:59 PM11/15/16
to venkatesu punugupati, Protocol Buffers
On Tue, Nov 15, 2016 at 2:33 PM, venkatesu punugupati <venkatesu....@gmail.com> wrote:
I am using 2..please let me know if it works in that way..
Protobuf only officially supports C# after 3.0.0. You are probably using some other C# implementations.
 

On Tue, Nov 15, 2016 at 5:11 PM Feng Xiao <xiao...@google.com> wrote:
On Tue, Nov 15, 2016 at 1:19 PM, venkatesu punugupati <venkatesu.punugupati@gmail.com> wrote:
Thanks for the response..
Let me add more details to get clear..
A.proto , B.Proto are two proto files
B.proto imports A.proto then if generate the code then you will get B.cs containing all the types present A also in the same file.
What version of protobuf are you using? I believe protoc should already be putting classes in B.cs and A.cs separately.
But i like to have A.cs as separate file and B.cs as separate file but B.cs refers the types present in A.cs  

Please let me know if this is possible.

On Tue, Nov 15, 2016 at 3:44 PM, Feng Xiao <xiao...@google.com> wrote:
On Tue, Nov 15, 2016 at 11:51 AM, venkatesu punugupati <venkatesu.punugupati@gmail.com> wrote:
I am feeling that, there should be option to generate code files inline with proto file inclusion.
For example, B.proto imports A.proto then code generation should be into two files A.cs & B.cs.
is this type feature already available?
There isn't such a feature. Both .proto files must be listed explicitly on the protoc command line.

--
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+unsubscribe@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.




--
Regards,
Venkatesu Punugupati

--
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+unsubscribe@googlegroups.com.

venkatesu punugupati

unread,
Nov 15, 2016, 6:12:22 PM11/15/16
to Feng Xiao, Protocol Buffers
https://developers.google.com/protocol-buffers/docs/proto

I am seeing 2 version also in the above link

On Tue, Nov 15, 2016 at 5:34 PM Feng Xiao <xiao...@google.com> wrote:
On Tue, Nov 15, 2016 at 2:33 PM, venkatesu punugupati <venkatesu....@gmail.com> wrote:
I am using 2..please let me know if it works in that way..
Protobuf only officially supports C# after 3.0.0. You are probably using some other C# implementations.
On Tue, Nov 15, 2016 at 5:11 PM Feng Xiao <xiao...@google.com> wrote:
On Tue, Nov 15, 2016 at 1:19 PM, venkatesu punugupati <venkatesu....@gmail.com> wrote:
Thanks for the response..
Let me add more details to get clear..
A.proto , B.Proto are two proto files
B.proto imports A.proto then if generate the code then you will get B.cs containing all the types present A also in the same file.
What version of protobuf are you using? I believe protoc should already be putting classes in B.cs and A.cs separately.
But i like to have A.cs as separate file and B.cs as separate file but B.cs refers the types present in A.cs  

Please let me know if this is possible.

On Tue, Nov 15, 2016 at 3:44 PM, Feng Xiao <xiao...@google.com> wrote:
On Tue, Nov 15, 2016 at 11:51 AM, venkatesu punugupati <venkatesu....@gmail.com> wrote:
I am feeling that, there should be option to generate code files inline with proto file inclusion.
For example, B.proto imports A.proto then code generation should be into two files A.cs & B.cs.
is this type feature already available?
There isn't such a feature. Both .proto files must be listed explicitly on the protoc command line.

--
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.
For more options, visit https://groups.google.com/d/optout.




--
Regards,
Venkatesu Punugupati

--
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.

Feng Xiao

unread,
Nov 15, 2016, 6:14:52 PM11/15/16
to venkatesu punugupati, Protocol Buffers
On Tue, Nov 15, 2016 at 3:12 PM, venkatesu punugupati <venkatesu....@gmail.com> wrote:
https://developers.google.com/protocol-buffers/docs/proto

I am seeing 2 version also in the above link
Yes, but C# only supports version 3.
 

On Tue, Nov 15, 2016 at 5:34 PM Feng Xiao <xiao...@google.com> wrote:
On Tue, Nov 15, 2016 at 2:33 PM, venkatesu punugupati <venkatesu.punugupati@gmail.com> wrote:
I am using 2..please let me know if it works in that way..
Protobuf only officially supports C# after 3.0.0. You are probably using some other C# implementations.
On Tue, Nov 15, 2016 at 5:11 PM Feng Xiao <xiao...@google.com> wrote:
On Tue, Nov 15, 2016 at 1:19 PM, venkatesu punugupati <venkatesu.punugupati@gmail.com> wrote:
Thanks for the response..
Let me add more details to get clear..
A.proto , B.Proto are two proto files
B.proto imports A.proto then if generate the code then you will get B.cs containing all the types present A also in the same file.
What version of protobuf are you using? I believe protoc should already be putting classes in B.cs and A.cs separately.
But i like to have A.cs as separate file and B.cs as separate file but B.cs refers the types present in A.cs  

Please let me know if this is possible.

On Tue, Nov 15, 2016 at 3:44 PM, Feng Xiao <xiao...@google.com> wrote:
On Tue, Nov 15, 2016 at 11:51 AM, venkatesu punugupati <venkatesu.punugupati@gmail.com> wrote:
I am feeling that, there should be option to generate code files inline with proto file inclusion.
For example, B.proto imports A.proto then code generation should be into two files A.cs & B.cs.
is this type feature already available?
There isn't such a feature. Both .proto files must be listed explicitly on the protoc command line.

--
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+unsubscribe@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.




--
Regards,
Venkatesu Punugupati

--
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+unsubscribe@googlegroups.com.

Jon Skeet

unread,
Nov 16, 2016, 2:04:06 AM11/16/16
to Protocol Buffers, xiao...@google.com
On Tuesday, 15 November 2016 21:20:01 UTC, venkatesu punugupati wrote:
Thanks for the response..
Let me add more details to get clear..
A.proto , B.Proto are two proto files
B.proto imports A.proto then if generate the code then you will get B.cs containing all the types present A also in the same file.

No, that's not true. B.cs will only contain the types declared in B.proto.
 
But i like to have A.cs as separate file and B.cs as separate file but B.cs refers the types present in A.cs  

And that's what already happens.

If you're seeing something else, then please:

- Give a complete example, with two proto files and the exact command line you're using to generate the code
- Make sure you're using the code related to this repository - there are a few other C# protobuf ports around

Jon

Jon Skeet

unread,
Nov 16, 2016, 2:04:55 AM11/16/16
to Protocol Buffers, xiao...@google.com
Sorry - "this repository" was vague - I meant https://github.com/google/protobuf

The corresponding NuGet packages are Google.Protobuf and Google.Protobuf.Tools.

Jon

venkatesu punugupati

unread,
Nov 16, 2016, 5:10:10 PM11/16/16
to Feng Xiao, Protocol Buffers
Thanks for the support..it is working in 3 version..

On Tue, Nov 15, 2016 at 6:14 PM Feng Xiao <xiao...@google.com> wrote:
On Tue, Nov 15, 2016 at 3:12 PM, venkatesu punugupati <venkatesu....@gmail.com> wrote:
https://developers.google.com/protocol-buffers/docs/proto

I am seeing 2 version also in the above link
Yes, but C# only supports version 3.
On Tue, Nov 15, 2016 at 5:34 PM Feng Xiao <xiao...@google.com> wrote:
On Tue, Nov 15, 2016 at 2:33 PM, venkatesu punugupati <venkatesu....@gmail.com> wrote:
I am using 2..please let me know if it works in that way..
Protobuf only officially supports C# after 3.0.0. You are probably using some other C# implementations.
On Tue, Nov 15, 2016 at 5:11 PM Feng Xiao <xiao...@google.com> wrote:
On Tue, Nov 15, 2016 at 1:19 PM, venkatesu punugupati <venkatesu....@gmail.com> wrote:
Thanks for the response..
Let me add more details to get clear..
A.proto , B.Proto are two proto files
B.proto imports A.proto then if generate the code then you will get B.cs containing all the types present A also in the same file.
What version of protobuf are you using? I believe protoc should already be putting classes in B.cs and A.cs separately.
But i like to have A.cs as separate file and B.cs as separate file but B.cs refers the types present in A.cs  

Please let me know if this is possible.

On Tue, Nov 15, 2016 at 3:44 PM, Feng Xiao <xiao...@google.com> wrote:
On Tue, Nov 15, 2016 at 11:51 AM, venkatesu punugupati <venkatesu....@gmail.com> wrote:
I am feeling that, there should be option to generate code files inline with proto file inclusion.
For example, B.proto imports A.proto then code generation should be into two files A.cs & B.cs.
is this type feature already available?
There isn't such a feature. Both .proto files must be listed explicitly on the protoc command line.

--
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.
For more options, visit https://groups.google.com/d/optout.




--
Regards,
Venkatesu Punugupati

--
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.
Reply all
Reply to author
Forward
0 new messages