Update C#-specific README

In particular, this removes the now-inaccurate instructions for building
Google.Protobuf targeting .NET 3.5.
pull/10256/head
Jon Skeet 2022-07-15 16:16:46 +01:00
parent a972626551
commit 2158851bb1
1 changed files with 16 additions and 30 deletions

View File

@ -16,18 +16,19 @@ To generate C# files from your `.proto` files, invoke `protoc` with the
Supported platforms
===================
The runtime library is built as a portable class library, supporting:
The runtime library is built as a class library, supporting targets of:
- .NET 4.5
- Windows 8
- Windows Phone Silverlight 8
- Windows Phone 8.1
- .NET Core
- .NET 5
- .NET 4.5+ (`net45`)
- .NET Standard 1.1 and 2.0 (`netstandard1.1` and `netstandard2.0`)
- .NET 5+ (`net50`)
You should be able to use Protocol Buffers in Visual Studio 2012 and
all later versions. This includes all code generated by `protoc`,
which only uses features from C# 3 and earlier.
which only uses features from C# 3 and earlier. When compiling generated
code with old compilers (before C# 7.2) you need to define the
`GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE` symbol in your project
so that the generated classes don't implement `IBufferMessage`, which uses
`ref struct` types.
Building
========
@ -42,12 +43,6 @@ in its implementation and runs tests under .NET 6. These features
have no impact when using the compiled code - they're only relevant
when building the `Google.Protobuf` assembly.
In order to run and debug the AddressBook example in the IDE, you must
install the optional component, ".Net Core 1.0 - 1.1 development tools
for Web" (as it's labelled in current versions of the VS2017
installer), above and beyond the main .NET Core cross-platform
development feature.
Testing
=======
@ -57,20 +52,11 @@ run using the Visual Studio Test Explorer or `dotnet test`.
.NET 3.5
========
We don't officially support .NET 3.5. However, there has been some effort
to make enabling .NET 3.5 support relatively painless in case you require it.
There's no guarantee that this will continue in the future, so rely on .NET
3.5 support at your peril.
To enable .NET 3.5 support, you must edit the `TargetFrameworks` elements of
[src/Google.Protobuf/Google.Protobuf.csproj](src/Google.Protobuf/Google.Protobuf.csproj)
(and [src/Google.Protobuf.Test/Google.Protobuf.Test.csproj](src/Google.Protobuf.Test/Google.Protobuf.Test.csproj)
if you want to run the unit tests):
Open the .csproj file in a text editor and simply add `net35` to the list of
target frameworks, noting that the `TargetFrameworks` element appears twice in
the file (once in the first `PropertyGroup` element, and again in the second
`PropertyGroup` element, i.e., the one with the conditional).
We don't support .NET 3.5. It *used* to be feasible to build this library
targeting .NET 3.5, but a number of changes requiring newer runtime/framework
features have been added over time. While it would no doubt be *possible* to
rework the current implementation to allow most of the functionality to be built
in .NET 3.5, this would create an undue maintenance burden.
History of C# protobufs
=======================
@ -82,9 +68,9 @@ and maintained by Google. All the development will be done in open, under this r
The previous project differs from this project in a number of ways:
- The old code only supported proto2; the new code only supports
- The old code only supported proto2; the new code initially only supported
proto3 (so no unknown fields, no required/optional distinction, no
extensions)
extensions); since then proto2 support has been added
- The old code was based on immutable message types and builders for
them
- The old code did not support maps or `oneof`