protobuf-net What Files Do I Need

프로그래밍 2014. 12. 16. 19:16 Posted by friday13th

protobuf-net can be used on multiple platforms, and many different builds are available.


In particular, though, there are 2 main uses:


- the "full" version, which includes as much type-model / runtime support as will work on your chosen platform

- the "core only" version, which includes just the fundamental reader/writer API and core objects


If you are on a rich framework like full .NET, the "full" version is entirely appropriate and will work fine.


However, if you are on a restricted framework (Silverlight, Phone 7, WinRT, etc) then many operations would either

be slow, or impossible. To address this, protobuf-net provides these frameworks with a "precompile" facility,

which moves all of the impossible / slow steps to a build-time operation, emitting a serialiation dll you

can reference and use (now very fast etc) from your chosen framework.


More information about the precompiler is here:

http://marcgravell.blogspot.co.uk/2012/07/introducing-protobuf-net-precompiler.html


protobuf-net also includes a utility for processing ".proto" files (the schema DSL used by multiple protobuf

implementations) into C# and VB.NET; this is the ProtoGen tool.


Neither precompile nor ProtoGen need to be deployed with your application.



So: what do I need?


example: running on .NET 4.0


solution: copy the files from Full\net30. Note that protobuf-net does not require any 4.0 features, so using "net30" will

give you all of protobuf-net including WCF support (which is the difference between "net20" and "net30").



example: running on Silverlight 4


option 1: copy the files from Full\sl4, and accept that it isn't quite as optimal as it could be - but perfectly fine

for light-to-moderate serialization usage.


option 2: copy the files from CoreOnly\sl4, and use "precompile" (in the Precompile folder) at build-time to generate

a serialization assembly (this also needs to be referenced and deployed from you application).


Additional:


Note that each framework contains 3 files:


- protobuf-net.dll  the library itself

- protobuf-net.xml  intellisense xml, used by thre IDE when developing

- protobuf-net.pdb debugging symbols, useful when debugging


Of these - the only one you **need** to deploy is the dll; the pdb may be useful for investigating crash reports. The

xml is used only by the IDE.


Folders:


cf20     compact framework 2.0

cf35     compact framework 3.5

ios          iPad/iPod/iPhone via MonoTouch

net11     regular .NET 1.1 (excluded generics)

net20        regular .NET 2.0 (excludes WCF hooks)

net30        regular .NET 3.0 or above (including 3.5, 4.0, 4.5, ...)

netcore45 windows store apps / windows runtime 4.5

portable     portable class library (phone 7, xna, silverlight)

sl4          silverlight 4 or above

wp71         windows phone 7.1

unity        specific to unity (avoids missing "interlocked" methods)


License:


The full license is shown separately, but boils down to "do what you like with it, don't sue me,

don't blame me if it goes horribly wrong, don't claim you wrote protobuf-net"


Finally:


All feedback welcome.