简体   繁体   中英

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM