MAGx2
MAGx2

Reputation: 3189

Protobuf toolchain/plugin for C#

In my company we already have a Java project (build by Maven) that is compiling proto files into Java via maven-protoc-plugin. Right now we are trying to do the same for C# (MSbuild + NuGet).

My problem is that I cannot find any toolchain for MSbuild that will compile proto into C# classes. I already have installed Google Protobuf for .NET 4.0 via NuGet.

I want to use protobuf 2 with VisualStudio 2013

PS My main programming language is Java and I really suck at C# so please speak to me really slow ;).

Upvotes: 0

Views: 879

Answers (2)

weismat
weismat

Reputation: 7411

I agree with the recommendation of protobuf-net
The tool for creating classes out of .proto file is called protogen.

protogen -i:test2.proto -o:test2.cs

Typically one would define Pre-Build Build Event in VS which will trigger the recreation of the classes before the actual compilation.

Upvotes: 1

Sean
Sean

Reputation: 62472

You want protobuf-net! It'll do everything you need!

Seriously though, it'll allow you to avoid using .proto files if you want by marking a class/property with attributes. However, it also comes with a pre-compiler to process your existing .proto files into C# classes. We use it on a large-scale project and it works really well.

Upvotes: 0

Related Questions