What NuGet package should I use between protobuf-net and google.protobuf for a new .net core app?
- It is for "Code first", not contract first.
- It is actually only for C# but would be great if more languages could easily read the format but not a must. I would favor performance over portability for binary serialization. I will also use XML or Json for portability (which for my opinion is better suited for portability although a lot slower).
With the edit, this becomes more answerable; first let's consider the options shown here, plus the Google implementation, in the context of the constraints in the question:
Google.Protobuf
- the reference implementation+
solid, dependable, well-maintained-
fundamentally "contract first" (unmanaged parser/generator), proto3 onlyprotobuf-csharp-port
-
strictly legacy, this effectively becameGoogle.Protobuf
; do not useSilentOrbit/protobuf
-
fundamentally "contract first" (managed parser/generator)protobuf-net
+
"code first" or "contract first" (optional managed parser/generator)+
"code first" is usable to any .NET language; .proto schemas can be generated from code for use with any other platform/language (marked+
because this is a non-essential nice to have, according to the question)+
reasonably well maintained (it isn't my day job, but I try!)So; given that the question says:
It seems to become a very simple selection process, with protobuf-net being the only horse in that race. In terms of .NET Core: protobuf-net is fully up to date with .NET Core, including being optimized for the span APIs and looking ahead to .NET 5 / C# 9 features.
As a side note: if you're starting green-field, I would recommend using the v3 versions of protobuf-net and using the highest currently defined
CompatibilityLevel