1*1b3f573fSAndroid Build Coastguard WorkerThis directory contains the C# Protocol Buffers runtime library. 2*1b3f573fSAndroid Build Coastguard Worker 3*1b3f573fSAndroid Build Coastguard WorkerUsage 4*1b3f573fSAndroid Build Coastguard Worker===== 5*1b3f573fSAndroid Build Coastguard Worker 6*1b3f573fSAndroid Build Coastguard WorkerThe easiest way how to use C# protobufs is via the `Google.Protobuf` 7*1b3f573fSAndroid Build Coastguard WorkerNuGet package. Just add the NuGet package to your VS project. 8*1b3f573fSAndroid Build Coastguard Worker 9*1b3f573fSAndroid Build Coastguard WorkerYou will also want to install the `Google.Protobuf.Tools` NuGet package, which 10*1b3f573fSAndroid Build Coastguard Workercontains precompiled version of `protoc.exe` and a copy of well known `.proto` 11*1b3f573fSAndroid Build Coastguard Workerfiles under the package's `tools` directory. 12*1b3f573fSAndroid Build Coastguard Worker 13*1b3f573fSAndroid Build Coastguard WorkerTo generate C# files from your `.proto` files, invoke `protoc` with the 14*1b3f573fSAndroid Build Coastguard Worker`--csharp_out` option. 15*1b3f573fSAndroid Build Coastguard Worker 16*1b3f573fSAndroid Build Coastguard WorkerSupported platforms 17*1b3f573fSAndroid Build Coastguard Worker=================== 18*1b3f573fSAndroid Build Coastguard Worker 19*1b3f573fSAndroid Build Coastguard WorkerThe runtime library is built as a portable class library, supporting: 20*1b3f573fSAndroid Build Coastguard Worker 21*1b3f573fSAndroid Build Coastguard Worker- .NET 4.5 22*1b3f573fSAndroid Build Coastguard Worker- Windows 8 23*1b3f573fSAndroid Build Coastguard Worker- Windows Phone Silverlight 8 24*1b3f573fSAndroid Build Coastguard Worker- Windows Phone 8.1 25*1b3f573fSAndroid Build Coastguard Worker- .NET Core 26*1b3f573fSAndroid Build Coastguard Worker 27*1b3f573fSAndroid Build Coastguard WorkerYou should be able to use Protocol Buffers in Visual Studio 2012 and 28*1b3f573fSAndroid Build Coastguard Workerall later versions. This includes all code generated by `protoc`, 29*1b3f573fSAndroid Build Coastguard Workerwhich only uses features from C# 3 and earlier. 30*1b3f573fSAndroid Build Coastguard Worker 31*1b3f573fSAndroid Build Coastguard WorkerBuilding 32*1b3f573fSAndroid Build Coastguard Worker======== 33*1b3f573fSAndroid Build Coastguard Worker 34*1b3f573fSAndroid Build Coastguard WorkerOpen the `src/Google.Protobuf.sln` solution in Visual Studio 2017 or 35*1b3f573fSAndroid Build Coastguard Workerlater. 36*1b3f573fSAndroid Build Coastguard Worker 37*1b3f573fSAndroid Build Coastguard WorkerAlthough *users* of this project are only expected to have Visual 38*1b3f573fSAndroid Build Coastguard WorkerStudio 2012 or later, *developers* of the library are required to 39*1b3f573fSAndroid Build Coastguard Workerhave Visual Studio 2017 or later, as the library uses C# 6 features 40*1b3f573fSAndroid Build Coastguard Workerin its implementation, as well as the new Visual Studio 2017 csproj 41*1b3f573fSAndroid Build Coastguard Workerformat. These features have no impact when using the compiled code - 42*1b3f573fSAndroid Build Coastguard Workerthey're only relevant when building the `Google.Protobuf` assembly. 43*1b3f573fSAndroid Build Coastguard Worker 44*1b3f573fSAndroid Build Coastguard WorkerIn order to run and debug the AddressBook example in the IDE, you must 45*1b3f573fSAndroid Build Coastguard Workerinstall the optional component, ".Net Core 1.0 - 1.1 development tools 46*1b3f573fSAndroid Build Coastguard Workerfor Web" (as it's labelled in current versions of the VS2017 47*1b3f573fSAndroid Build Coastguard Workerinstaller), above and beyond the main .NET Core cross-platform 48*1b3f573fSAndroid Build Coastguard Workerdevelopment feature. 49*1b3f573fSAndroid Build Coastguard Worker 50*1b3f573fSAndroid Build Coastguard WorkerTesting 51*1b3f573fSAndroid Build Coastguard Worker======= 52*1b3f573fSAndroid Build Coastguard Worker 53*1b3f573fSAndroid Build Coastguard WorkerThe unit tests use [NUnit 3](https://github.com/nunit/nunit). Tests can be 54*1b3f573fSAndroid Build Coastguard Workerrun using the Visual Studio Test Explorer or `dotnet test`. 55*1b3f573fSAndroid Build Coastguard Worker 56*1b3f573fSAndroid Build Coastguard Worker.NET 3.5 57*1b3f573fSAndroid Build Coastguard Worker======== 58*1b3f573fSAndroid Build Coastguard Worker 59*1b3f573fSAndroid Build Coastguard WorkerWe don't officially support .NET 3.5. However, there has been some effort 60*1b3f573fSAndroid Build Coastguard Workerto make enabling .NET 3.5 support relatively painless in case you require it. 61*1b3f573fSAndroid Build Coastguard WorkerThere's no guarantee that this will continue in the future, so rely on .NET 62*1b3f573fSAndroid Build Coastguard Worker3.5 support at your peril. 63*1b3f573fSAndroid Build Coastguard Worker 64*1b3f573fSAndroid Build Coastguard WorkerTo enable .NET 3.5 support, you must edit the `TargetFrameworks` elements of 65*1b3f573fSAndroid Build Coastguard Worker[src/Google.Protobuf/Google.Protobuf.csproj](src/Google.Protobuf/Google.Protobuf.csproj) 66*1b3f573fSAndroid Build Coastguard Worker(and [src/Google.Protobuf.Test/Google.Protobuf.Test.csproj](src/Google.Protobuf.Test/Google.Protobuf.Test.csproj) 67*1b3f573fSAndroid Build Coastguard Workerif you want to run the unit tests): 68*1b3f573fSAndroid Build Coastguard Worker 69*1b3f573fSAndroid Build Coastguard WorkerOpen the .csproj file in a text editor and simply add `net35` to the list of 70*1b3f573fSAndroid Build Coastguard Workertarget frameworks, noting that the `TargetFrameworks` element appears twice in 71*1b3f573fSAndroid Build Coastguard Workerthe file (once in the first `PropertyGroup` element, and again in the second 72*1b3f573fSAndroid Build Coastguard Worker`PropertyGroup` element, i.e., the one with the conditional). 73*1b3f573fSAndroid Build Coastguard Worker 74*1b3f573fSAndroid Build Coastguard WorkerHistory of C# protobufs 75*1b3f573fSAndroid Build Coastguard Worker======================= 76*1b3f573fSAndroid Build Coastguard Worker 77*1b3f573fSAndroid Build Coastguard WorkerThis subtree was originally imported from https://github.com/jskeet/protobuf-csharp-port 78*1b3f573fSAndroid Build Coastguard Workerand represents the latest development version of C# protobufs, that will now be developed 79*1b3f573fSAndroid Build Coastguard Workerand maintained by Google. All the development will be done in open, under this repository 80*1b3f573fSAndroid Build Coastguard Worker(https://github.com/protocolbuffers/protobuf). 81*1b3f573fSAndroid Build Coastguard Worker 82*1b3f573fSAndroid Build Coastguard WorkerThe previous project differs from this project in a number of ways: 83*1b3f573fSAndroid Build Coastguard Worker 84*1b3f573fSAndroid Build Coastguard Worker- The old code only supported proto2; the new code only supports 85*1b3f573fSAndroid Build Coastguard Workerproto3 (so no unknown fields, no required/optional distinction, no 86*1b3f573fSAndroid Build Coastguard Workerextensions) 87*1b3f573fSAndroid Build Coastguard Worker- The old code was based on immutable message types and builders for 88*1b3f573fSAndroid Build Coastguard Workerthem 89*1b3f573fSAndroid Build Coastguard Worker- The old code did not support maps or `oneof` 90*1b3f573fSAndroid Build Coastguard Worker- The old code had its own JSON representation, whereas the new code 91*1b3f573fSAndroid Build Coastguard Workeruses the standard protobuf JSON representation 92*1b3f573fSAndroid Build Coastguard Worker- The old code had no notion of the "well-known types" which have 93*1b3f573fSAndroid Build Coastguard Workerspecial support in the new code 94*1b3f573fSAndroid Build Coastguard Worker- The old project supported some older platforms (such as older 95*1b3f573fSAndroid Build Coastguard Workerversions of Silverlight) which are not currently supported in the 96*1b3f573fSAndroid Build Coastguard Workernew project 97