How to use Protocol buffers in visual studio c#.net

2,964 views
Skip to first unread message

vinu

unread,
Dec 9, 2010, 9:06:40 AM12/9/10
to Protocol Buffers
Sir,


Any body please send me any example program and how to use protocol
buffers in c#.net visual stduio

vinu

unread,
Dec 9, 2010, 9:07:42 AM12/9/10
to Protocol Buffers
Any body send me example program on protocl buffers using in c#.net

Marc Gravell

unread,
Dec 9, 2010, 2:38:34 PM12/9/10
to vinu, Protocol Buffers
It depends on the exact scenario

Are you already using protocol buffers for other platforms? Working from .proto?

There are several C# implementations, with different levels of VS integration. The two I would mainly think of is Jon Skeet's C# port  (http://code.google.com/p/protobuf-csharp-port/) and my own offering: protobuf-net (http://code.google.com/p/protobuf-net/).

Jon's port exposes an almost identical API to the Java version (and IIRC has very similar tooling); protobuf-net looks at it the other way around: it is .NET centric *first*, with .proto support secondary - as such, with protobuf-net you don't strictly *need* a .proto *at all*. Of course, you *can* use a .proto (an msi for VS integration is on the protobuf-net home page, with a write-up here: http://marcgravell.blogspot.com/2009/07/protobuf-net-now-with-added-orcas.html) - but if I'm honest I *personally* mainly use it *without* .proto, as I am usually just talking .NET to .NET, and I just want to serialize stuff.

Jon may be offer to give more specific pointers about his version.

Marc Gravell


--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To post to this group, send email to prot...@googlegroups.com.
To unsubscribe from this group, send email to protobuf+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.




--
Regards,

Marc

Jon Skeet

unread,
Dec 10, 2010, 12:21:11 PM12/10/10
to Protocol Buffers
On Dec 9, 2:06 pm, vinu <vinodkumara...@gmail.com> wrote:
> Any body please send me any example program and how to use protocol
> buffers in c#.net visual stduio

Well, we have a short tutorial on the C# port page:
http://code.google.com/p/protobuf-csharp-port/wiki/GettingStarted

We have three significant updates coming down the pipe:
- An implementation of the "lite" runtime
- A new set of build scripts (replacing NAnt with msbuild 4)
- Improved code generation, including running protoc automatically,
providing options on the command line instead of in the proto file,
and removing the options dependency from the generated code

I'm hoping to land these before Christmas.

Jon

Thad

unread,
Dec 13, 2010, 5:18:49 PM12/13/10
to Protocol Buffers
> - Improved code generation, including running protoc automatically,
> providing options on the command line instead of in the proto file,
> and removing the options dependency from the generated code

A thought on that:
I was looking at Marc's generator today to figure out how to get a --
proto_path argument passed through from the CustomTool runner in
Visual Studio. Unless I'm missing something, it appears that VS
doesn't provide a very nice way to get arguments to a custom tool on a
per-file basis. He is using the "Custom Tool Namespace" property to
piggyback in arguments to the code generator. From a usage perspective
this is fairly messy but I couldn't find a better way to do it. I
thought at the time that if it were possible to specify custom options
directly in the file (like dotnet-protobufs) it would be a whole lot
cleaner.

Having the command line option is probably better for a build script
generating the files, but if you ever package it up into a custom tool
for VS, it might be nice to still be able to specifying the options in
the file.

-Thad

Marc Gravell

unread,
Dec 14, 2010, 4:25:43 AM12/14/10
to Thad, Protocol Buffers
Yes; *at the moment* I don't make that search path very accessible. When I have the lid up I'll look at that, but for now if you really need to handle a complex include path, there is an ugly workaround... and not via the IDE tools (only at the command line).

Marc

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To post to this group, send email to prot...@googlegroups.com.
To unsubscribe from this group, send email to protobuf+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.




--
Regards,

Marc
Reply all
Reply to author
Forward
0 new messages