John Brink
John Brink

Reputation: 658

Make PCL-friendly C# classes with protobuf-net generator

I would like to use Protocol Buffers in a Xamarin app, so I need to use a PCL project to house my non-platform-specific code.

I used the protobuf-net protogen to convert a .proto file into a .cs file, but it was incompatible with PCL projects. Making it compatible was as easy as removing every global::System.Serializable attribute from the file, but I'd like to know if there is a way to make the protogen not put those attributes in the generated file.

This would be very helpful if I were to a) find a way to automatically build .proto classes, b) change some of the very many message types on a regular basis, or c) hand over the project to someone who doesn't understand the problem.

Upvotes: 4

Views: 593

Answers (1)

Marc Gravell
Marc Gravell

Reputation: 1063393

Yes, the protogen tool has options to emit that. Try adding -p:lightFramework to enable this. -p:help should show the other options provided by the chosen language plugin.

Upvotes: 5

Related Questions