|
|
@ -31,28 +31,23 @@ which only uses features from C# 3 and earlier. |
|
|
|
Building |
|
|
|
Building |
|
|
|
======== |
|
|
|
======== |
|
|
|
|
|
|
|
|
|
|
|
Open the `src/Google.Protobuf.sln` solution in Visual Studio 2015 or |
|
|
|
Open the `src/Google.Protobuf.sln` solution in Visual Studio 2017 or |
|
|
|
later. |
|
|
|
later. |
|
|
|
|
|
|
|
|
|
|
|
Although *users* of this project are only expected to have Visual |
|
|
|
Although *users* of this project are only expected to have Visual |
|
|
|
Studio 2012 or later, *developers* of the library are required to |
|
|
|
Studio 2012 or later, *developers* of the library are required to |
|
|
|
have Visual Studio 2015 or later, as the library uses C# 6 features |
|
|
|
have Visual Studio 2017 or later, as the library uses C# 6 features |
|
|
|
in its implementation. These features have no impact when using the |
|
|
|
in its implementation, as well as the new Visual Studio 2017 csproj |
|
|
|
compiled code - they're only relevant when building the |
|
|
|
format. These features have no impact when using the compiled code - |
|
|
|
`Google.Protobuf` assembly. |
|
|
|
they're only relevant when building the `Google.Protobuf` assembly. |
|
|
|
|
|
|
|
|
|
|
|
Testing |
|
|
|
Testing |
|
|
|
======= |
|
|
|
======= |
|
|
|
|
|
|
|
|
|
|
|
The unit tests use [NUnit 3](https://github.com/nunit/nunit). Vanilla NUnit doesn't |
|
|
|
The unit tests use [NUnit 3](https://github.com/nunit/nunit). NUnit doesn't yet |
|
|
|
support .NET Core, so to run the tests you'll need to use |
|
|
|
support `dotnet test`, so for now the test project is a console application |
|
|
|
[dotnet-test-nunit](https://github.com/nunit/dotnet-test-nunit). |
|
|
|
using NUnitLite. Simply run `Google.Protobuf.Test.exe` to run the unit tests |
|
|
|
`dotnet-test-nunit` can also run tests for .NET 4.5+, so to run the tests |
|
|
|
directly, or else use `dotnet run`. |
|
|
|
for both .NET Core and .NET 4.5, you can simply open the |
|
|
|
|
|
|
|
`Package Manager Console` in Visual Studio and execute: |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
dotnet test Google.Protobuf.Test |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.NET 3.5 |
|
|
|
.NET 3.5 |
|
|
|
======== |
|
|
|
======== |
|
|
@ -62,35 +57,15 @@ 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 |
|
|
|
There's no guarantee that this will continue in the future, so rely on .NET |
|
|
|
3.5 support at your peril. |
|
|
|
3.5 support at your peril. |
|
|
|
|
|
|
|
|
|
|
|
To enable .NET 3.5 support: |
|
|
|
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) |
|
|
|
1. Modify [src/Google.Protobuf/project.json](src/Google.Protobuf/project.json) to add `"net35": {}` to `"frameworks"`. |
|
|
|
(and [src/Google.Protobuf.Test/Google.Protobuf.Test.csproj](src/Google.Protobuf.Test/Google.Protobuf.Test.csproj) |
|
|
|
2. Modify [src/Google.Protobuf.Test/project.json](src/Google.Protobuf/project.json): |
|
|
|
if you want to run the unit tests): |
|
|
|
1. Add `"net35": {}` to `"frameworks"`. |
|
|
|
|
|
|
|
2. `dotnet-test-nunit` doesn't support .NET 3.5, so remove it from |
|
|
|
Open the .csproj file in a text editor and simply add `net35` to the list of |
|
|
|
the project-wide `"dependencies"` and add it to the framework-specific |
|
|
|
target frameworks, noting that the `TargetFrameworks` element appears twice in |
|
|
|
dependencies under `"net451"` and `"netcoreapp1.0"`. |
|
|
|
the file (once in the first `PropertyGroup` element, and again in the second |
|
|
|
|
|
|
|
`PropertyGroup` element, i.e., the one with the conditional). |
|
|
|
Note that `dotnet-test-nunit` doesn't support .NET 3.5. You can instead run the |
|
|
|
|
|
|
|
tests with [NUnit 3 console](https://github.com/nunit/nunit-console) |
|
|
|
|
|
|
|
by running something like: |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
nunit3-console.exe "Google.Protobuf.Test\bin\Debug\net35\win7-x64\Google.Protobuf.Test.dll" --inprocess |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The exact path may differ depending on your environment (e.g., the `win7-x64` |
|
|
|
|
|
|
|
directory may be called something else). The `--inprocess` flag seems to be a |
|
|
|
|
|
|
|
necessary workaround for a bug in NUnit; otherwise, you'll receive |
|
|
|
|
|
|
|
an error "Exception has been thrown by the target of an invocation" |
|
|
|
|
|
|
|
([possibly related issue](https://github.com/nunit/nunit/issues/1480)). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If you still want to run the .NET 4.5 and .NET Core tests, you can do so by |
|
|
|
|
|
|
|
specifying the framework when using `dotnet-test-nunit`, i.e. from |
|
|
|
|
|
|
|
`Package Manager Console` in Visual Studio: |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
dotnet test Google.Protobuf.Test --framework netcoreapp1.0 |
|
|
|
|
|
|
|
dotnet test Google.Protobuf.Test --framework net451 |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
History of C# protobufs |
|
|
|
History of C# protobufs |
|
|
|
======================= |
|
|
|
======================= |
|
|
|