OLD | NEW |
1 This directory contains the C# Protocol Buffers runtime library. | 1 This directory contains the C# Protocol Buffers runtime library. |
2 | 2 |
3 Status: Alpha - ready for early adopters | 3 Status: Beta - ready for external testing |
4 ======================================== | 4 ========================================= |
5 | |
6 This code is still under significant churn. Unlike the original port, | |
7 it only supports proto3 (but not *all* of proto3 yet) - there are no | |
8 unknown fields or extensions, for example. protoc will (eventually) | |
9 deliberately fail if it is asked to generate C# code for proto2 | |
10 messages other than descriptor.proto, which is still required for | |
11 reflection. (It's currently exposed publicly, but won't be | |
12 eventually.) | |
13 | |
14 Also unlike the original port, the new version embraces mutability - | |
15 there are no builder types. | |
16 | 5 |
17 Usage | 6 Usage |
18 ===== | 7 ===== |
19 | 8 |
20 The easiest way how to use C# protobufs is via the `Google.Protobuf` | 9 The easiest way how to use C# protobufs is via the `Google.Protobuf` |
21 NuGet package. Just add the NuGet package to your VS project. | 10 NuGet package. Just add the NuGet package to your VS project. |
22 | 11 |
23 Besides C# runtime library, the NuGet package also contains | 12 Besides C# runtime library, the NuGet package also contains |
24 precompiled version of `protoc.exe` and a copy of well known `.proto` | 13 precompiled version of `protoc.exe` and a copy of well known `.proto` |
25 files under the package's `tools` directory. | 14 files under the package's `tools` directory. |
26 | 15 |
27 To generate C# files from your `.proto` files, invoke `protoc` with the | 16 To generate C# files from your `.proto` files, invoke `protoc` with the |
28 `--csharp_out` option. | 17 `--csharp_out` option. |
29 | 18 |
30 Supported platforms | 19 Supported platforms |
31 =================== | 20 =================== |
32 | 21 |
33 The runtime library is built as a portable class library, supporting: | 22 The runtime library is built as a portable class library, supporting: |
34 | 23 |
35 - .NET 4.5 | 24 - .NET 4.5 |
36 - Windows 8 | 25 - Windows 8 |
37 - Windows Phone Silverlight 8 | 26 - Windows Phone Silverlight 8 |
38 - Windows Phone 8.1 | 27 - Windows Phone 8.1 |
39 - .NET Core (dnxcore) | 28 - .NET Core |
| 29 |
| 30 You should be able to use Protocol Buffers in Visual Studio 2012 and |
| 31 all later versions. This includes all code generated by `protoc`, |
| 32 which only uses features from C# 3 and earlier. |
40 | 33 |
41 Building | 34 Building |
42 ======== | 35 ======== |
43 | 36 |
44 Open the `src/Google.Protobuf.sln` solution in Visual Studio. Click "Build solut
ion" to build the solution. You should be able to run the NUnit test from Test E
xplorer (you might need to install NUnit Visual Studio add-in). | 37 Open the `src/Google.Protobuf.sln` solution in Visual Studio 2015 or |
| 38 later. You should be able to run the NUnit test from Test Explorer |
| 39 (you might need to install NUnit Visual Studio add-in). |
45 | 40 |
46 Supported Visual Studio versions are VS2013 (update 4) and VS2015. On Linux, you
can also use Monodevelop 5.9 (older versions might work fine). | 41 Although *users* of this project are only expected to have Visual |
| 42 Studio 2012 or later, *developers* of the library are required to |
| 43 have Visual Studio 2015 or later, as the library uses C# 6 features |
| 44 in its implementation. These features have no impact when using the |
| 45 compiled code - they're only relevant when building the |
| 46 `Google.Protobuf` assembly. |
47 | 47 |
48 History of C# protobufs | 48 History of C# protobufs |
49 ======================= | 49 ======================= |
50 | 50 |
51 This subtree was originally imported from https://github.com/jskeet/protobuf-csh
arp-port | 51 This subtree was originally imported from https://github.com/jskeet/protobuf-csh
arp-port |
52 and represents the latest development version of C# protobufs, that will now be
developed | 52 and represents the latest development version of C# protobufs, that will now be
developed |
53 and maintained by Google. All the development will be done in open, under this r
epository | 53 and maintained by Google. All the development will be done in open, under this r
epository |
54 (https://github.com/google/protobuf). | 54 (https://github.com/google/protobuf). |
| 55 |
| 56 The previous project differs from this project in a number of ways: |
| 57 |
| 58 - The old code only supported proto2; the new code only supports |
| 59 proto3 (so no unknown fields, no required/optional distinction, no |
| 60 extensions) |
| 61 - The old code was based on immutable message types and builders for |
| 62 them |
| 63 - The old code did not support maps or `oneof` |
| 64 - The old code had its own JSON representation, whereas the new code |
| 65 uses the standard protobuf JSON representation |
| 66 - The old code had no notion of the "well-known types" which have |
| 67 special support in the new code |
| 68 - The old project supported some older platforms (such as older |
| 69 versions of Silverlight) which are not currently supported in the |
| 70 new project |
OLD | NEW |