diff --git a/.travis.yml b/.travis.yml
index 46abbb9e3..7cfe0dfba 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,7 +14,6 @@ script:
env:
- CONFIG=cpp
- CONFIG=cpp_distcheck
- - CONFIG=csharp
- CONFIG=golang
- CONFIG=java_jdk6
- CONFIG=java_jdk7
@@ -52,10 +51,6 @@ matrix:
env: CONFIG=javanano_jdk7
- os: osx
env: CONFIG=javanano_oracle7
- # Requires installing mono, currently travis.sh is doing that with apt-get
- # which doesn't work on OS X.
- - os: osx
- env: CONFIG=csharp
# Requires installing golang, currently travis.sh is doing that with apt-get
# which doesn't work on OS X.
- os: osx
@@ -70,6 +65,13 @@ matrix:
env: CONFIG=objectivec_osx
- os: linux
env: CONFIG=objectivec_cocoapods_integration
+ # The dotnet environment requires Ubuntu 14.04 or 16.04. This
+ # configuration is effectively an "extra" one, outside the
+ # autogenerated matrix.
+ include:
+ - os: linux
+ env: CONFIG=csharp
+ dist: trusty
allow_failures:
# These currently do not work on OS X but are being worked on by @haberman.
- os: osx
diff --git a/Makefile.am b/Makefile.am
index 72cc91490..80df33585 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -59,22 +59,19 @@ csharp_EXTRA_DIST= \
csharp/keys/README.md \
csharp/protos/unittest_issues.proto \
csharp/src/AddressBook/AddPerson.cs \
- csharp/src/AddressBook/AddressBook.csproj \
csharp/src/AddressBook/Addressbook.cs \
+ csharp/src/AddressBook/AddressBook.xproj \
csharp/src/AddressBook/ListPeople.cs \
csharp/src/AddressBook/Program.cs \
- csharp/src/AddressBook/Properties/AssemblyInfo.cs \
csharp/src/AddressBook/SampleUsage.cs \
- csharp/src/AddressBook/app.config \
- csharp/src/Google.Protobuf.Conformance/App.config \
+ csharp/src/AddressBook/project.json \
csharp/src/Google.Protobuf.Conformance/Conformance.cs \
- csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj \
+ csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.xproj \
csharp/src/Google.Protobuf.Conformance/Program.cs \
- csharp/src/Google.Protobuf.Conformance/Properties/AssemblyInfo.cs \
- csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj \
+ csharp/src/Google.Protobuf.Conformance/project.json \
+ csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.xproj \
csharp/src/Google.Protobuf.JsonDump/Program.cs \
- csharp/src/Google.Protobuf.JsonDump/Properties/AssemblyInfo.cs \
- csharp/src/Google.Protobuf.JsonDump/app.config \
+ csharp/src/Google.Protobuf.JsonDump/project.json \
csharp/src/Google.Protobuf.Test/ByteStringTest.cs \
csharp/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs \
csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs \
@@ -87,13 +84,11 @@ csharp_EXTRA_DIST= \
csharp/src/Google.Protobuf.Test/EqualityTester.cs \
csharp/src/Google.Protobuf.Test/FieldCodecTest.cs \
csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs \
- csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj \
+ csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.xproj \
csharp/src/Google.Protobuf.Test/IssuesTest.cs \
csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs \
csharp/src/Google.Protobuf.Test/JsonParserTest.cs \
csharp/src/Google.Protobuf.Test/JsonTokenizerTest.cs \
- csharp/src/Google.Protobuf.Test/Properties/AppManifest.xml \
- csharp/src/Google.Protobuf.Test/Properties/AssemblyInfo.cs \
csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs \
csharp/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs \
csharp/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs \
@@ -110,7 +105,7 @@ csharp_EXTRA_DIST= \
csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs \
csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs \
csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs \
- csharp/src/Google.Protobuf.Test/packages.config \
+ csharp/src/Google.Protobuf.Test/project.json \
csharp/src/Google.Protobuf.sln \
csharp/src/Google.Protobuf/ByteArray.cs \
csharp/src/Google.Protobuf/ByteString.cs \
@@ -124,8 +119,7 @@ csharp_EXTRA_DIST= \
csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs \
csharp/src/Google.Protobuf/FieldCodec.cs \
csharp/src/Google.Protobuf/FrameworkPortability.cs \
- csharp/src/Google.Protobuf/Google.Protobuf.csproj \
- csharp/src/Google.Protobuf/Google.Protobuf.nuspec \
+ csharp/src/Google.Protobuf/Google.Protobuf.xproj \
csharp/src/Google.Protobuf/IDeepCloneable.cs \
csharp/src/Google.Protobuf/IMessage.cs \
csharp/src/Google.Protobuf/InvalidJsonException.cs \
@@ -183,7 +177,7 @@ csharp_EXTRA_DIST= \
csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs \
csharp/src/Google.Protobuf/WellKnownTypes/WrappersPartial.cs \
csharp/src/Google.Protobuf/WireFormat.cs \
- csharp/src/Google.Protobuf/packages.config \
+ csharp/src/Google.Protobuf/project.json \
csharp/src/packages/repositories.config
java_EXTRA_DIST= \
diff --git a/appveyor.bat b/appveyor.bat
index 9a46b9289..0e6dd5206 100644
--- a/appveyor.bat
+++ b/appveyor.bat
@@ -19,9 +19,12 @@ goto :EOF
:build_csharp
echo Building C#
cd csharp\src
-nuget restore
-msbuild Google.Protobuf.sln /p:Platform="Any CPU" /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" || goto error
-nunit-console Google.Protobuf.Test\bin\%configuration%\Google.Protobuf.Test.dll || goto error
+dotnet restore
+dotnet build -c %configuration% Google.Protobuf Google.Protobuf.Test Google.Protobuf.Conformance || goto error
+
+echo Testing C#
+dotnet test -c %configuration% Google.Protobuf.Test || goto error
+
goto :EOF
:error
diff --git a/appveyor.yml b/appveyor.yml
index c84ecae2f..ce797c69a 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -14,10 +14,16 @@ environment:
- language: csharp
+# Our build scripts run tests automatically; we don't want AppVeyor
+# to try to detect them itself.
+test: off
+
install:
- ps: Start-FileDownload https://googlemock.googlecode.com/files/gmock-1.7.0.zip
- 7z x gmock-1.7.0.zip
- rename gmock-1.7.0 gmock
+ - ps: Start-FileDownload https://go.microsoft.com/fwlink/?LinkID=809122 -FileName dotnetsdk.exe
+ - dotnetsdk.exe /install /quiet /norestart
before_build:
- if %platform%==Win32 set generator=Visual Studio 12
diff --git a/conformance/Makefile.am b/conformance/Makefile.am
index 64adb7c5b..b76407eea 100644
--- a/conformance/Makefile.am
+++ b/conformance/Makefile.am
@@ -246,7 +246,7 @@ conformance-java-lite: javac_middleman_lite
conformance-csharp: $(other_language_protoc_outputs)
@echo "Writing shortcut script conformance-csharp..."
@echo '#! /bin/sh' > conformance-csharp
- @echo 'mono ../csharp/src/Google.Protobuf.Conformance/bin/Release/Google.Protobuf.Conformance.exe "$$@"' >> conformance-csharp
+ @echo 'dotnet ../csharp/src/Google.Protobuf.Conformance/bin/Release/netcoreapp1.0/Google.Protobuf.Conformance.dll "$$@"' >> conformance-csharp
@chmod +x conformance-csharp
# Targets for actually running tests.
diff --git a/csharp/.gitignore b/csharp/.gitignore
index c88f741e3..8ba884998 100644
--- a/csharp/.gitignore
+++ b/csharp/.gitignore
@@ -1,16 +1,10 @@
-#
-# Untracked directories
-#
-src/AddressBook/bin
-src/AddressBook/obj
-src/Google.Protobuf/bin/
-src/Google.Protobuf/obj/
-src/Google.Protobuf.Conformance/bin/
-src/Google.Protobuf.Conformance/obj/
-src/Google.Protobuf.Test/bin/
-src/Google.Protobuf.Test/obj/
-src/Google.Protobuf.JsonDump/bin/
-src/Google.Protobuf.JsonDump/obj/
+# Output
+bin
+obj
+project.lock.json
+TestResult.xml
+
+# Possibly legacy now?
mono/bin
mono/tmp
mono/protoc
@@ -23,6 +17,7 @@ lib/NUnit
#
# Untracked files
#
+.vs
*.user
*.suo
*.nupkg
diff --git a/csharp/build_packages.bat b/csharp/build_packages.bat
index 1502f0634..37732e7c6 100644
--- a/csharp/build_packages.bat
+++ b/csharp/build_packages.bat
@@ -1,10 +1,7 @@
@rem Builds Google.Protobuf NuGet packages
-@rem Adjust the location of nuget.exe
-set NUGET=C:\nuget\nuget.exe
-
-@rem Build src/Google.Protobuf.sln solution in Release configuration first.
-%NUGET% pack src\Google.Protobuf\Google.Protobuf.nuspec -Symbols || goto :error
+dotnet restore src
+dotnet pack -c Release src\Google.Protobuf || goto :error
goto :EOF
diff --git a/csharp/buildall.sh b/csharp/buildall.sh
index 45af705f3..cab322299 100755
--- a/csharp/buildall.sh
+++ b/csharp/buildall.sh
@@ -1,17 +1,16 @@
#!/bin/bash
-# Use mono to build solution and run all tests.
-# Adjust these to reflect the location of nunit-console in your system.
-NUNIT_CONSOLE=nunit-console
-
-# The rest you can leave intact
CONFIG=Release
SRC=$(dirname $0)/src
set -ex
-echo Building the solution.
-xbuild /p:Configuration=$CONFIG $SRC/Google.Protobuf.sln
+echo Building relevant projects.
+dotnet build -c $CONFIG $SRC/Google.Protobuf $SRC/Google.Protobuf.Test $SRC/Google.Protobuf.Conformance
echo Running tests.
-$NUNIT_CONSOLE $SRC/Google.Protobuf.Test/bin/$CONFIG/Google.Protobuf.Test.dll
+# Only test netcoreapp1.0, which uses the .NET Core runtime.
+# If we want to test the .NET 4.5 version separately, we could
+# run Mono explicitly. However, we don't have any differences between
+# the .NET 4.5 and netstandard1.0 assemblies.
+dotnet test -c $CONFIG -f netcoreapp1.0 $SRC/Google.Protobuf.Test
diff --git a/csharp/src/AddressBook/AddressBook.csproj b/csharp/src/AddressBook/AddressBook.csproj
deleted file mode 100644
index 8f8ca7e23..000000000
--- a/csharp/src/AddressBook/AddressBook.csproj
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 9.0.30729
- 2.0
- {A31F5FB2-4FF3-432A-B35B-5CD203606311}
- Exe
- Properties
- Google.Protobuf.Examples.AddressBook
- AddressBook
- v4.5
- 512
- Google.Protobuf.Examples.AddressBook.Program
-
-
-
-
- true
- full
- false
- bin\Debug
- obj\Debug\
- DEBUG;TRACE
- prompt
- 4
- true
- Off
- false
-
-
- pdbonly
- true
- bin\Release
- obj\Release\
- TRACE
- prompt
- 4
- true
- Off
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {6908BDCE-D925-43F3-94AC-A531E6DF2591}
- Google.Protobuf
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/csharp/src/AddressBook/AddressBook.xproj b/csharp/src/AddressBook/AddressBook.xproj
new file mode 100644
index 000000000..4c9925e83
--- /dev/null
+++ b/csharp/src/AddressBook/AddressBook.xproj
@@ -0,0 +1,19 @@
+
+
+
+ 14.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+
+
+
+ afb63919-1e05-43b4-802a-8fb8c9b2f463
+ AddressBook
+ .\obj
+ .\bin\
+
+
+
+ 2.0
+
+
+
\ No newline at end of file
diff --git a/csharp/src/AddressBook/Properties/AssemblyInfo.cs b/csharp/src/AddressBook/Properties/AssemblyInfo.cs
deleted file mode 100644
index 9cb014c0d..000000000
--- a/csharp/src/AddressBook/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly: AssemblyTitle("AddressBook")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("AddressBook")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: AssemblyVersion("3.0.0.0")]
-[assembly: AssemblyFileVersion("3.0.0.0")]
diff --git a/csharp/src/AddressBook/SampleUsage.cs b/csharp/src/AddressBook/SampleUsage.cs
index aaaedda4d..941d865aa 100644
--- a/csharp/src/AddressBook/SampleUsage.cs
+++ b/csharp/src/AddressBook/SampleUsage.cs
@@ -66,7 +66,7 @@ namespace Google.Protobuf.Examples.AddressBook
// The message performs a deep-comparison on equality:
if (restored.People.Count != 1 || !person.Equals(restored.People[0]))
{
- throw new ApplicationException("There is a bad person in here!");
+ throw new Exception("There is a bad person in here!");
}
}
}
diff --git a/csharp/src/AddressBook/app.config b/csharp/src/AddressBook/app.config
deleted file mode 100644
index a80813afe..000000000
--- a/csharp/src/AddressBook/app.config
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/csharp/src/AddressBook/project.json b/csharp/src/AddressBook/project.json
new file mode 100644
index 000000000..c500bdc29
--- /dev/null
+++ b/csharp/src/AddressBook/project.json
@@ -0,0 +1,20 @@
+{
+ "buildOptions": {
+ "debugType": "portable",
+ "emitEntryPoint": true,
+ "additionalArguments": [ "/main:Google.Protobuf.Examples.AddressBook.Program" ]
+ },
+ "dependencies": {
+ "Google.Protobuf": { "target": "project" }
+ },
+ "frameworks": {
+ "netcoreapp1.0": {
+ "dependencies": {
+ "Microsoft.NETCore.App": {
+ "type": "platform",
+ "version": "1.0.0"
+ }
+ }
+ }
+ }
+}
diff --git a/csharp/src/Google.Protobuf.Conformance/App.config b/csharp/src/Google.Protobuf.Conformance/App.config
deleted file mode 100644
index 8e1564635..000000000
--- a/csharp/src/Google.Protobuf.Conformance/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj b/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj
deleted file mode 100644
index 82f728d19..000000000
--- a/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {0607D1B8-80D6-4B35-9857-1263C1B32B94}
- Exe
- Properties
- Google.Protobuf.Conformance
- Google.Protobuf.Conformance
- v4.5
- 512
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {6908bdce-d925-43f3-94ac-a531e6df2591}
- Google.Protobuf
-
-
-
-
-
\ No newline at end of file
diff --git a/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.xproj b/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.xproj
new file mode 100644
index 000000000..99ff14653
--- /dev/null
+++ b/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.xproj
@@ -0,0 +1,19 @@
+
+
+
+ 14.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+
+
+
+ dddc055b-e185-4181-bab0-072f0f984569
+ Google.Protobuf.Conformance
+ .\obj
+ .\bin\
+
+
+
+ 2.0
+
+
+
\ No newline at end of file
diff --git a/csharp/src/Google.Protobuf.Conformance/Properties/AssemblyInfo.cs b/csharp/src/Google.Protobuf.Conformance/Properties/AssemblyInfo.cs
deleted file mode 100644
index d22e90fd8..000000000
--- a/csharp/src/Google.Protobuf.Conformance/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#endregion
-
-using System.Reflection;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Google.Protobuf.Conformance")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Google.Protobuf.Conformance")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: AssemblyVersion("3.0.0.0")]
-[assembly: AssemblyFileVersion("3.0.0.0")]
diff --git a/csharp/src/Google.Protobuf.Conformance/project.json b/csharp/src/Google.Protobuf.Conformance/project.json
new file mode 100644
index 000000000..84b23c456
--- /dev/null
+++ b/csharp/src/Google.Protobuf.Conformance/project.json
@@ -0,0 +1,19 @@
+{
+ "buildOptions": {
+ "debugType": "portable",
+ "emitEntryPoint": true
+ },
+ "dependencies": {
+ "Google.Protobuf": { "target": "project" }
+ },
+ "frameworks": {
+ "netcoreapp1.0": {
+ "dependencies": {
+ "Microsoft.NETCore.App": {
+ "type": "platform",
+ "version": "1.0.0"
+ }
+ }
+ }
+ }
+}
diff --git a/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj b/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj
deleted file mode 100644
index ede1f7781..000000000
--- a/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 9.0.30729
- 2.0
- {D7282E99-2DC3-405B-946F-177DB2FD2AE2}
- Exe
- Properties
- Google.Protobuf.JsonDump
- Google.Protobuf.JsonDump
- v4.5
- 512
-
-
-
-
- true
- full
- false
- bin\Debug
- obj\Debug\
- DEBUG;TRACE
- prompt
- 4
- true
- Off
- false
-
-
- pdbonly
- true
- bin\Release
- obj\Release\
- TRACE
- prompt
- 4
- true
- Off
- false
-
-
-
-
-
-
-
-
-
-
-
- {6908BDCE-D925-43F3-94AC-A531E6DF2591}
- Google.Protobuf
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.xproj b/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.xproj
new file mode 100644
index 000000000..27095be5b
--- /dev/null
+++ b/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.xproj
@@ -0,0 +1,19 @@
+
+
+
+ 14.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+
+
+
+ 9695e08f-9829-497d-b95c-b38f28d48690
+ Google.Protobuf.JsonDump
+ .\obj
+ .\bin\
+
+
+
+ 2.0
+
+
+
\ No newline at end of file
diff --git a/csharp/src/Google.Protobuf.JsonDump/Program.cs b/csharp/src/Google.Protobuf.JsonDump/Program.cs
index 99e60e901..296b2f3f1 100644
--- a/csharp/src/Google.Protobuf.JsonDump/Program.cs
+++ b/csharp/src/Google.Protobuf.JsonDump/Program.cs
@@ -32,6 +32,7 @@
using System;
using System.IO;
+using System.Reflection;
namespace Google.Protobuf.ProtoDump
{
@@ -55,7 +56,7 @@ namespace Google.Protobuf.ProtoDump
Console.Error.WriteLine("Unable to load type {0}.", args[0]);
return 1;
}
- if (!typeof(IMessage).IsAssignableFrom(type))
+ if (!typeof(IMessage).GetTypeInfo().IsAssignableFrom(type))
{
Console.Error.WriteLine("Type {0} doesn't implement IMessage.", args[0]);
return 1;
diff --git a/csharp/src/Google.Protobuf.JsonDump/Properties/AssemblyInfo.cs b/csharp/src/Google.Protobuf.JsonDump/Properties/AssemblyInfo.cs
deleted file mode 100644
index d980b0139..000000000
--- a/csharp/src/Google.Protobuf.JsonDump/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly: AssemblyTitle("ProtoDump")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("ProtoDump")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: AssemblyVersion("3.0.0.0")]
-[assembly: AssemblyFileVersion("3.0.0.0")]
diff --git a/csharp/src/Google.Protobuf.JsonDump/app.config b/csharp/src/Google.Protobuf.JsonDump/app.config
deleted file mode 100644
index 51278a456..000000000
--- a/csharp/src/Google.Protobuf.JsonDump/app.config
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/csharp/src/Google.Protobuf.JsonDump/project.json b/csharp/src/Google.Protobuf.JsonDump/project.json
new file mode 100644
index 000000000..84b23c456
--- /dev/null
+++ b/csharp/src/Google.Protobuf.JsonDump/project.json
@@ -0,0 +1,19 @@
+{
+ "buildOptions": {
+ "debugType": "portable",
+ "emitEntryPoint": true
+ },
+ "dependencies": {
+ "Google.Protobuf": { "target": "project" }
+ },
+ "frameworks": {
+ "netcoreapp1.0": {
+ "dependencies": {
+ "Microsoft.NETCore.App": {
+ "type": "platform",
+ "version": "1.0.0"
+ }
+ }
+ }
+ }
+}
diff --git a/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs b/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
index 8ed54cfb4..6852f75f8 100644
--- a/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
+++ b/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
@@ -75,10 +75,96 @@ namespace Google.Protobuf.Collections
}
[Test]
- public void Add_RepeatedField()
+ public void AddRange_SlowPath()
+ {
+ var list = new RepeatedField();
+ list.AddRange(new[] { "foo", "bar" }.Select(x => x));
+ Assert.AreEqual(2, list.Count);
+ Assert.AreEqual("foo", list[0]);
+ Assert.AreEqual("bar", list[1]);
+ }
+
+ [Test]
+ public void AddRange_SlowPath_NullsProhibited_ReferenceType()
+ {
+ var list = new RepeatedField();
+ // It's okay for this to throw ArgumentNullException if necessary.
+ // It's not ideal, but not awful.
+ Assert.Catch(() => list.AddRange(new[] { "foo", null }.Select(x => x)));
+ }
+
+ [Test]
+ public void AddRange_SlowPath_NullsProhibited_NullableValueType()
+ {
+ var list = new RepeatedField();
+ // It's okay for this to throw ArgumentNullException if necessary.
+ // It's not ideal, but not awful.
+ Assert.Catch(() => list.AddRange(new[] { 20, (int?)null }.Select(x => x)));
+ }
+
+ [Test]
+ public void AddRange_Optimized_NonNullableValueType()
+ {
+ var list = new RepeatedField();
+ list.AddRange(new List { 20, 30 });
+ Assert.AreEqual(2, list.Count);
+ Assert.AreEqual(20, list[0]);
+ Assert.AreEqual(30, list[1]);
+ }
+
+ [Test]
+ public void AddRange_Optimized_ReferenceType()
+ {
+ var list = new RepeatedField();
+ list.AddRange(new List { "foo", "bar" });
+ Assert.AreEqual(2, list.Count);
+ Assert.AreEqual("foo", list[0]);
+ Assert.AreEqual("bar", list[1]);
+ }
+
+ [Test]
+ public void AddRange_Optimized_NullableValueType()
+ {
+ var list = new RepeatedField();
+ list.AddRange(new List { 20, 30 });
+ Assert.AreEqual(2, list.Count);
+ Assert.AreEqual((int?) 20, list[0]);
+ Assert.AreEqual((int?) 30, list[1]);
+ }
+
+ [Test]
+ public void AddRange_Optimized_NullsProhibited_ReferenceType()
+ {
+ // We don't just trust that a collection with a nullable element type doesn't contain nulls
+ var list = new RepeatedField();
+ // It's okay for this to throw ArgumentNullException if necessary.
+ // It's not ideal, but not awful.
+ Assert.Catch(() => list.AddRange(new List { "foo", null }));
+ }
+
+ [Test]
+ public void AddRange_Optimized_NullsProhibited_NullableValueType()
+ {
+ // We don't just trust that a collection with a nullable element type doesn't contain nulls
+ var list = new RepeatedField();
+ // It's okay for this to throw ArgumentNullException if necessary.
+ // It's not ideal, but not awful.
+ Assert.Catch(() => list.AddRange(new List { 20, null }));
+ }
+
+ [Test]
+ public void AddRange_AlreadyNotEmpty()
+ {
+ var list = new RepeatedField { 1, 2, 3 };
+ list.AddRange(new List { 4, 5, 6 });
+ CollectionAssert.AreEqual(new[] { 1, 2, 3, 4, 5, 6 }, list);
+ }
+
+ [Test]
+ public void AddRange_RepeatedField()
{
var list = new RepeatedField { "original" };
- list.Add(new RepeatedField { "foo", "bar" });
+ list.AddRange(new RepeatedField { "foo", "bar" });
Assert.AreEqual(3, list.Count);
Assert.AreEqual("original", list[0]);
Assert.AreEqual("foo", list[1]);
diff --git a/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs b/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs
index c616470e8..0e2bad59e 100644
--- a/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs
+++ b/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs
@@ -32,6 +32,7 @@
using System.Collections.Generic;
using System.IO;
+using System.Reflection;
using Google.Protobuf.TestProtos;
using NUnit.Framework;
@@ -162,7 +163,7 @@ namespace Google.Protobuf
codedOutput.Flush();
Assert.AreEqual(0, stream.Position);
Assert.AreEqual(0, codec.CalculateSizeWithTag(codec.DefaultValue));
- if (typeof(T).IsValueType)
+ if (typeof(T).GetTypeInfo().IsValueType)
{
Assert.AreEqual(default(T), codec.DefaultValue);
}
diff --git a/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj b/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
deleted file mode 100644
index 4f37c5e25..000000000
--- a/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
+++ /dev/null
@@ -1,143 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 9.0.30729
- 2.0
- {DD01ED24-3750-4567-9A23-1DB676A15610}
- Library
- Properties
- Google.Protobuf
- Google.Protobuf.Test
- v4.5
- 512
- 3.5
-
-
-
-
-
-
- true
- full
- false
- bin\Debug
- obj\Debug\
- DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate)
- prompt
- 4
- true
- Off
- false
-
-
- pdbonly
- true
- bin\Release
- obj\Release\
- TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate)
- prompt
- 4
- true
- Off
- false
-
-
- pdbonly
- true
- bin\ReleaseSigned
- obj\ReleaseSigned\
- TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate)
- prompt
- 4
- true
- Off
- false
- True
- ..\..\keys\Google.Protobuf.snk
-
-
-
-
- ..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll
- True
-
-
- ..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.interfaces.dll
- True
-
-
- ..\packages\NUnit.2.6.4\lib\nunit.framework.dll
- True
-
-
- ..\packages\NUnitTestAdapter.2.0.0\lib\nunit.util.dll
- True
-
-
- ..\packages\NUnitTestAdapter.2.0.0\lib\NUnit.VisualStudio.TestAdapter.dll
- True
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {6908BDCE-D925-43F3-94AC-A531E6DF2591}
- Google.Protobuf
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.xproj b/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.xproj
new file mode 100644
index 000000000..a9a1cc049
--- /dev/null
+++ b/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.xproj
@@ -0,0 +1,19 @@
+
+
+
+ 14.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+
+
+
+ 580eb013-d3c7-4578-b845-015f4a3b0591
+ Google.Protobuf.Test
+ .\obj
+ .\bin\
+
+
+
+ 2.0
+
+
+
\ No newline at end of file
diff --git a/csharp/src/Google.Protobuf.Test/Properties/AppManifest.xml b/csharp/src/Google.Protobuf.Test/Properties/AppManifest.xml
deleted file mode 100644
index a95523275..000000000
--- a/csharp/src/Google.Protobuf.Test/Properties/AppManifest.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
diff --git a/csharp/src/Google.Protobuf.Test/Properties/AssemblyInfo.cs b/csharp/src/Google.Protobuf.Test/Properties/AssemblyInfo.cs
deleted file mode 100644
index d00acf855..000000000
--- a/csharp/src/Google.Protobuf.Test/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly: AssemblyTitle("Google.Protobuf.Test")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Google.Protobuf.Test")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: AssemblyVersion("3.0.0.0")]
-[assembly: AssemblyFileVersion("3.0.0.0")]
diff --git a/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs b/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs
index f21be7d9b..4aecc998d 100644
--- a/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs
+++ b/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs
@@ -96,7 +96,7 @@ namespace Google.Protobuf.WellKnownTypes
var message = SampleMessages.CreateFullTestAllTypes();
var any = Any.Pack(message);
var text = any.ToString();
- Assert.That(text, Is.StringContaining("\"@value\": \"" + message.ToByteString().ToBase64() + "\""));
+ Assert.That(text, Does.Contain("\"@value\": \"" + message.ToByteString().ToBase64() + "\""));
}
[Test]
diff --git a/csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs b/csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs
index 89bc82759..1d9908b4d 100644
--- a/csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs
+++ b/csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs
@@ -46,8 +46,8 @@ namespace Google.Protobuf.WellKnownTypes
var mask = new FieldMask { Paths = { input } };
var text = mask.ToString();
// More specific test below
- Assert.That(text, Is.StringContaining("@warning"));
- Assert.That(text, Is.StringContaining(input));
+ Assert.That(text, Does.Contain("@warning"));
+ Assert.That(text, Does.Contain(input));
}
[Test]
diff --git a/csharp/src/Google.Protobuf.Test/packages.config b/csharp/src/Google.Protobuf.Test/packages.config
deleted file mode 100644
index c76539928..000000000
--- a/csharp/src/Google.Protobuf.Test/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/csharp/src/Google.Protobuf.Test/project.json b/csharp/src/Google.Protobuf.Test/project.json
new file mode 100644
index 000000000..87b732c9b
--- /dev/null
+++ b/csharp/src/Google.Protobuf.Test/project.json
@@ -0,0 +1,44 @@
+{
+ "buildOptions": {
+ "debugType": "portable",
+ "keyFile": "../../keys/Google.Protobuf.snk"
+ },
+
+ "configurations": {
+ "Debug": {
+ "buildOptions": {
+ "define": [ "DEBUG", "TRACE" ]
+ }
+ },
+ "Release": {
+ "buildOptions": {
+ "define": [ "RELEASE", "TRACE" ],
+ "optimize": true
+ }
+ }
+ },
+
+ "dependencies": {
+ "Google.Protobuf": { "target": "project" },
+ "NUnit": "3.4.0",
+ "dotnet-test-nunit": "3.4.0-alpha-2",
+ },
+
+ "testRunner": "nunit",
+
+ "frameworks": {
+ "netcoreapp1.0": {
+ "imports" : [ "dnxcore50", "netcoreapp1.0", "portable-net45+win8" ],
+ "buildOptions": {
+ "define": [ "PCL" ]
+ },
+ "dependencies": {
+ "Microsoft.NETCore.App": {
+ "version": "1.0.0",
+ "type": "platform"
+ },
+ "System.Console": "4.0.0"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/csharp/src/Google.Protobuf.sln b/csharp/src/Google.Protobuf.sln
index 72d87f766..3c62bba33 100644
--- a/csharp/src/Google.Protobuf.sln
+++ b/csharp/src/Google.Protobuf.sln
@@ -1,54 +1,43 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2015
-VisualStudioVersion = 14.0.24720.0
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 14.0.24720.0
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Google.Protobuf", "Google.Protobuf\Google.Protobuf.csproj", "{6908BDCE-D925-43F3-94AC-A531E6DF2591}"
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AddressBook", "AddressBook\AddressBook.xproj", "{AFB63919-1E05-43B4-802A-8FB8C9B2F463}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Google.Protobuf.Test", "Google.Protobuf.Test\Google.Protobuf.Test.csproj", "{DD01ED24-3750-4567-9A23-1DB676A15610}"
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Google.Protobuf", "Google.Protobuf\Google.Protobuf.xproj", "{9B576380-726D-4142-8238-60A43AB0E35A}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddressBook", "AddressBook\AddressBook.csproj", "{A31F5FB2-4FF3-432A-B35B-5CD203606311}"
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Google.Protobuf.Test", "Google.Protobuf.Test\Google.Protobuf.Test.xproj", "{580EB013-D3C7-4578-B845-015F4A3B0591}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Google.Protobuf.JsonDump", "Google.Protobuf.JsonDump\Google.Protobuf.JsonDump.csproj", "{D7282E99-2DC3-405B-946F-177DB2FD2AE2}"
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Google.Protobuf.Conformance", "Google.Protobuf.Conformance\Google.Protobuf.Conformance.xproj", "{DDDC055B-E185-4181-BAB0-072F0F984569}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Google.Protobuf.Conformance", "Google.Protobuf.Conformance\Google.Protobuf.Conformance.csproj", "{0607D1B8-80D6-4B35-9857-1263C1B32B94}"
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Google.Protobuf.JsonDump", "Google.Protobuf.JsonDump\Google.Protobuf.JsonDump.xproj", "{9695E08F-9829-497D-B95C-B38F28D48690}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
- ReleaseSigned|Any CPU = ReleaseSigned|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU
- {6908BDCE-D925-43F3-94AC-A531E6DF2591}.ReleaseSigned|Any CPU.ActiveCfg = ReleaseSigned|Any CPU
- {6908BDCE-D925-43F3-94AC-A531E6DF2591}.ReleaseSigned|Any CPU.Build.0 = ReleaseSigned|Any CPU
- {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU
- {DD01ED24-3750-4567-9A23-1DB676A15610}.ReleaseSigned|Any CPU.ActiveCfg = ReleaseSigned|Any CPU
- {DD01ED24-3750-4567-9A23-1DB676A15610}.ReleaseSigned|Any CPU.Build.0 = ReleaseSigned|Any CPU
- {A31F5FB2-4FF3-432A-B35B-5CD203606311}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A31F5FB2-4FF3-432A-B35B-5CD203606311}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A31F5FB2-4FF3-432A-B35B-5CD203606311}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A31F5FB2-4FF3-432A-B35B-5CD203606311}.Release|Any CPU.Build.0 = Release|Any CPU
- {A31F5FB2-4FF3-432A-B35B-5CD203606311}.ReleaseSigned|Any CPU.ActiveCfg = Release|Any CPU
- {A31F5FB2-4FF3-432A-B35B-5CD203606311}.ReleaseSigned|Any CPU.Build.0 = Release|Any CPU
- {D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Release|Any CPU.Build.0 = Release|Any CPU
- {D7282E99-2DC3-405B-946F-177DB2FD2AE2}.ReleaseSigned|Any CPU.ActiveCfg = Release|Any CPU
- {D7282E99-2DC3-405B-946F-177DB2FD2AE2}.ReleaseSigned|Any CPU.Build.0 = Release|Any CPU
- {0607D1B8-80D6-4B35-9857-1263C1B32B94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0607D1B8-80D6-4B35-9857-1263C1B32B94}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0607D1B8-80D6-4B35-9857-1263C1B32B94}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0607D1B8-80D6-4B35-9857-1263C1B32B94}.Release|Any CPU.Build.0 = Release|Any CPU
- {0607D1B8-80D6-4B35-9857-1263C1B32B94}.ReleaseSigned|Any CPU.ActiveCfg = Release|Any CPU
- {0607D1B8-80D6-4B35-9857-1263C1B32B94}.ReleaseSigned|Any CPU.Build.0 = Release|Any CPU
+ {AFB63919-1E05-43B4-802A-8FB8C9B2F463}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AFB63919-1E05-43B4-802A-8FB8C9B2F463}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AFB63919-1E05-43B4-802A-8FB8C9B2F463}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AFB63919-1E05-43B4-802A-8FB8C9B2F463}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9B576380-726D-4142-8238-60A43AB0E35A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9B576380-726D-4142-8238-60A43AB0E35A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9B576380-726D-4142-8238-60A43AB0E35A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9B576380-726D-4142-8238-60A43AB0E35A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {580EB013-D3C7-4578-B845-015F4A3B0591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {580EB013-D3C7-4578-B845-015F4A3B0591}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {580EB013-D3C7-4578-B845-015F4A3B0591}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {580EB013-D3C7-4578-B845-015F4A3B0591}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DDDC055B-E185-4181-BAB0-072F0F984569}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DDDC055B-E185-4181-BAB0-072F0F984569}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DDDC055B-E185-4181-BAB0-072F0F984569}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DDDC055B-E185-4181-BAB0-072F0F984569}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9695E08F-9829-497D-B95C-B38F28D48690}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9695E08F-9829-497D-B95C-B38F28D48690}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9695E08F-9829-497D-B95C-B38F28D48690}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9695E08F-9829-497D-B95C-B38F28D48690}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/csharp/src/Google.Protobuf/Collections/MapField.cs b/csharp/src/Google.Protobuf/Collections/MapField.cs
index 053f75585..537ce261a 100644
--- a/csharp/src/Google.Protobuf/Collections/MapField.cs
+++ b/csharp/src/Google.Protobuf/Collections/MapField.cs
@@ -30,14 +30,13 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
+using Google.Protobuf.Compatibility;
using Google.Protobuf.Reflection;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using System.Text;
-using Google.Protobuf.Compatibility;
namespace Google.Protobuf.Collections
{
@@ -113,7 +112,7 @@ namespace Google.Protobuf.Collections
// Validation of arguments happens in ContainsKey and the indexer
if (ContainsKey(key))
{
- throw new ArgumentException("Key already exists in map", "key");
+ throw new ArgumentException("Key already exists in map", nameof(key));
}
this[key] = value;
}
@@ -125,7 +124,7 @@ namespace Google.Protobuf.Collections
/// true if the map contains the given key; false otherwise.
public bool ContainsKey(TKey key)
{
- ProtoPreconditions.CheckNotNullUnconstrained(key, "key");
+ ProtoPreconditions.CheckNotNullUnconstrained(key, nameof(key));
return map.ContainsKey(key);
}
@@ -142,7 +141,7 @@ namespace Google.Protobuf.Collections
/// true if the map contained the given key before the entry was removed; false otherwise.
public bool Remove(TKey key)
{
- ProtoPreconditions.CheckNotNullUnconstrained(key, "key");
+ ProtoPreconditions.CheckNotNullUnconstrained(key, nameof(key));
LinkedListNode> node;
if (map.TryGetValue(key, out node))
{
@@ -190,7 +189,7 @@ namespace Google.Protobuf.Collections
{
get
{
- ProtoPreconditions.CheckNotNullUnconstrained(key, "key");
+ ProtoPreconditions.CheckNotNullUnconstrained(key, nameof(key));
TValue value;
if (TryGetValue(key, out value))
{
@@ -200,11 +199,11 @@ namespace Google.Protobuf.Collections
}
set
{
- ProtoPreconditions.CheckNotNullUnconstrained(key, "key");
+ ProtoPreconditions.CheckNotNullUnconstrained(key, nameof(key));
// value == null check here is redundant, but avoids boxing.
if (value == null)
{
- ProtoPreconditions.CheckNotNullUnconstrained(value, "value");
+ ProtoPreconditions.CheckNotNullUnconstrained(value, nameof(value));
}
LinkedListNode> node;
var pair = new KeyValuePair(key, value);
@@ -236,7 +235,7 @@ namespace Google.Protobuf.Collections
/// The entries to add to the map.
public void Add(IDictionary entries)
{
- ProtoPreconditions.CheckNotNull(entries, "entries");
+ ProtoPreconditions.CheckNotNull(entries, nameof(entries));
foreach (var pair in entries)
{
Add(pair.Key, pair.Value);
@@ -315,7 +314,7 @@ namespace Google.Protobuf.Collections
{
if (item.Key == null)
{
- throw new ArgumentException("Key is null", "item");
+ throw new ArgumentException("Key is null", nameof(item));
}
LinkedListNode> node;
if (map.TryGetValue(item.Key, out node) &&
@@ -503,7 +502,7 @@ namespace Google.Protobuf.Collections
void IDictionary.Remove(object key)
{
- ProtoPreconditions.CheckNotNull(key, "key");
+ ProtoPreconditions.CheckNotNull(key, nameof(key));
if (!(key is TKey))
{
return;
@@ -532,7 +531,7 @@ namespace Google.Protobuf.Collections
{
get
{
- ProtoPreconditions.CheckNotNull(key, "key");
+ ProtoPreconditions.CheckNotNull(key, nameof(key));
if (!(key is TKey))
{
return null;
@@ -714,11 +713,11 @@ namespace Google.Protobuf.Collections
{
if (arrayIndex < 0)
{
- throw new ArgumentOutOfRangeException("arrayIndex");
+ throw new ArgumentOutOfRangeException(nameof(arrayIndex));
}
if (arrayIndex + Count >= array.Length)
{
- throw new ArgumentException("Not enough space in the array", "array");
+ throw new ArgumentException("Not enough space in the array", nameof(array));
}
foreach (var item in this)
{
@@ -745,11 +744,11 @@ namespace Google.Protobuf.Collections
{
if (index < 0)
{
- throw new ArgumentOutOfRangeException("index");
+ throw new ArgumentOutOfRangeException(nameof(index));
}
if (index + Count >= array.Length)
{
- throw new ArgumentException("Not enough space in the array", "array");
+ throw new ArgumentException("Not enough space in the array", nameof(array));
}
foreach (var item in this)
{
diff --git a/csharp/src/Google.Protobuf/Collections/RepeatedField.cs b/csharp/src/Google.Protobuf/Collections/RepeatedField.cs
index d1db856c9..7bb564480 100644
--- a/csharp/src/Google.Protobuf/Collections/RepeatedField.cs
+++ b/csharp/src/Google.Protobuf/Collections/RepeatedField.cs
@@ -34,7 +34,6 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
-using System.Text;
namespace Google.Protobuf.Collections
{
@@ -227,10 +226,7 @@ namespace Google.Protobuf.Collections
/// The item to add.
public void Add(T item)
{
- if (item == null)
- {
- throw new ArgumentNullException("item");
- }
+ ProtoPreconditions.CheckNotNullUnconstrained(item, nameof(item));
EnsureSize(count + 1);
array[count++] = item;
}
@@ -285,48 +281,84 @@ namespace Google.Protobuf.Collections
///
/// Gets the number of elements contained in the collection.
///
- public int Count { get { return count; } }
+ public int Count => count;
///
/// Gets a value indicating whether the collection is read-only.
///
- public bool IsReadOnly { get { return false; } }
-
- // TODO: Remove this overload and just handle it in the one below, at execution time?
+ public bool IsReadOnly => false;
///
/// Adds all of the specified values into this collection.
///
/// The values to add to this collection.
- public void Add(RepeatedField values)
+ public void AddRange(IEnumerable values)
{
- if (values == null)
- {
- throw new ArgumentNullException("values");
- }
- EnsureSize(count + values.count);
- // We know that all the values will be valid, because it's a RepeatedField.
- Array.Copy(values.array, 0, array, count, values.count);
- count += values.count;
- }
+ ProtoPreconditions.CheckNotNull(values, nameof(values));
- ///
- /// Adds all of the specified values into this collection.
- ///
- /// The values to add to this collection.
- public void Add(IEnumerable values)
- {
- if (values == null)
+ // Optimization 1: If the collection we're adding is already a RepeatedField,
+ // we know the values are valid.
+ var otherRepeatedField = values as RepeatedField;
+ if (otherRepeatedField != null)
{
- throw new ArgumentNullException("values");
+ EnsureSize(count + otherRepeatedField.count);
+ Array.Copy(otherRepeatedField.array, 0, array, count, otherRepeatedField.count);
+ count += otherRepeatedField.count;
+ return;
}
- // TODO: Check for ICollection and get the Count, to optimize?
+
+ // Optimization 2: The collection is an ICollection, so we can expand
+ // just once and ask the collection to copy itself into the array.
+ var collection = values as ICollection;
+ if (collection != null)
+ {
+ var extraCount = collection.Count;
+ // For reference types and nullable value types, we need to check that there are no nulls
+ // present. (This isn't a thread-safe approach, but we don't advertise this is thread-safe.)
+ // We expect the JITter to optimize this test to true/false, so it's effectively conditional
+ // specialization.
+ if (default(T) == null)
+ {
+ // TODO: Measure whether iterating once to check and then letting the collection copy
+ // itself is faster or slower than iterating and adding as we go. For large
+ // collections this will not be great in terms of cache usage... but the optimized
+ // copy may be significantly faster than doing it one at a time.
+ foreach (var item in collection)
+ {
+ if (item == null)
+ {
+ throw new ArgumentException("Sequence contained null element", nameof(values));
+ }
+ }
+ }
+ EnsureSize(count + extraCount);
+ collection.CopyTo(array, count);
+ count += extraCount;
+ return;
+ }
+
+ // We *could* check for ICollection as well, but very very few collections implement
+ // ICollection but not ICollection. (HashSet does, for one...)
+
+ // Fall back to a slower path of adding items one at a time.
foreach (T item in values)
{
Add(item);
}
}
+ ///
+ /// Adds all of the specified values into this collection. This method is present to
+ /// allow repeated fields to be constructed from queries within collection initializers.
+ /// Within non-collection-initializer code, consider using the equivalent
+ /// method instead for clarity.
+ ///
+ /// The values to add to this collection.
+ public void Add(IEnumerable values)
+ {
+ AddRange(values);
+ }
+
///
/// Returns an enumerator that iterates through the collection.
///
@@ -418,10 +450,7 @@ namespace Google.Protobuf.Collections
/// The zero-based index of the item, or -1 if it is not found.
public int IndexOf(T item)
{
- if (item == null)
- {
- throw new ArgumentNullException("item");
- }
+ ProtoPreconditions.CheckNotNullUnconstrained(item, nameof(item));
EqualityComparer comparer = EqualityComparer.Default;
for (int i = 0; i < count; i++)
{
@@ -440,13 +469,10 @@ namespace Google.Protobuf.Collections
/// The item to insert.
public void Insert(int index, T item)
{
- if (item == null)
- {
- throw new ArgumentNullException("item");
- }
+ ProtoPreconditions.CheckNotNullUnconstrained(item, nameof(item));
if (index < 0 || index > count)
{
- throw new ArgumentOutOfRangeException("index");
+ throw new ArgumentOutOfRangeException(nameof(index));
}
EnsureSize(count + 1);
Array.Copy(array, index, array, index + 1, count - index);
@@ -462,7 +488,7 @@ namespace Google.Protobuf.Collections
{
if (index < 0 || index >= count)
{
- throw new ArgumentOutOfRangeException("index");
+ throw new ArgumentOutOfRangeException(nameof(index));
}
Array.Copy(array, index + 1, array, index, count - index - 1);
count--;
@@ -494,7 +520,7 @@ namespace Google.Protobuf.Collections
{
if (index < 0 || index >= count)
{
- throw new ArgumentOutOfRangeException("index");
+ throw new ArgumentOutOfRangeException(nameof(index));
}
return array[index];
}
@@ -502,27 +528,24 @@ namespace Google.Protobuf.Collections
{
if (index < 0 || index >= count)
{
- throw new ArgumentOutOfRangeException("index");
- }
- if (value == null)
- {
- throw new ArgumentNullException("value");
+ throw new ArgumentOutOfRangeException(nameof(index));
}
+ ProtoPreconditions.CheckNotNullUnconstrained(value, nameof(value));
array[index] = value;
}
}
#region Explicit interface implementation for IList and ICollection.
- bool IList.IsFixedSize { get { return false; } }
+ bool IList.IsFixedSize => false;
void ICollection.CopyTo(Array array, int index)
{
Array.Copy(this.array, 0, array, index, count);
}
- bool ICollection.IsSynchronized { get { return false; } }
+ bool ICollection.IsSynchronized => false;
- object ICollection.SyncRoot { get { return this; } }
+ object ICollection.SyncRoot => this;
object IList.this[int index]
{
diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.csproj b/csharp/src/Google.Protobuf/Google.Protobuf.csproj
deleted file mode 100644
index 5557612a8..000000000
--- a/csharp/src/Google.Protobuf/Google.Protobuf.csproj
+++ /dev/null
@@ -1,168 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 9.0.30729
- 2.0
- {6908BDCE-D925-43F3-94AC-A531E6DF2591}
- Library
- Properties
- Google.Protobuf
- Google.Protobuf
- {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- Profile259
- v4.5
- 512
- 3.5
- 10.0
-
-
-
-
- true
- full
- false
- bin\Debug
- obj\Debug\
- bin\Debug\Google.Protobuf.xml
-
-
- DEBUG;TRACE
- prompt
- 4
- true
- Off
- true
-
-
- pdbonly
- true
- bin\Release
- obj\Release\
- $(OutputPath)\$(AssemblyName).xml
-
-
- TRACE
- prompt
- 4
- true
- Off
- true
-
-
- pdbonly
- true
- bin\ReleaseSigned
- obj\ReleaseSigned\
- $(OutputPath)\$(AssemblyName).xml
-
-
- TRACE;SIGNED
- prompt
- 4
- true
- Off
- True
- ..\..\keys\Google.Protobuf.snk
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
\ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.nuspec b/csharp/src/Google.Protobuf/Google.Protobuf.nuspec
deleted file mode 100644
index e7b47ffbb..000000000
--- a/csharp/src/Google.Protobuf/Google.Protobuf.nuspec
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
- Google.Protobuf
- Google Protocol Buffers C#
- C# runtime library for Protocol Buffers - Google's data interchange format.
- See project site for more info.
- 3.0.0-beta4
- Google Inc.
- protobuf-packages
- https://github.com/google/protobuf/blob/master/LICENSE
- https://github.com/google/protobuf
- false
- C# proto3 support
- Copyright 2015, Google Inc.
- Protocol Buffers Binary Serialization Format Google proto proto3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.xproj b/csharp/src/Google.Protobuf/Google.Protobuf.xproj
new file mode 100644
index 000000000..c68e0db31
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Google.Protobuf.xproj
@@ -0,0 +1,19 @@
+
+
+
+ 14.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+
+
+
+ 9b576380-726d-4142-8238-60a43ab0e35a
+ Google.Protobuf
+ .\obj
+ .\bin\
+
+
+
+ 2.0
+
+
+
\ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs b/csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs
index 1673edfb0..9b179bd7c 100644
--- a/csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs
+++ b/csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs
@@ -30,7 +30,6 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
-using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
@@ -38,30 +37,13 @@ using System.Security;
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
-[assembly: AssemblyTitle("Google.Protobuf")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Google.Protobuf")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
#if !NCRUNCH
[assembly: AllowPartiallyTrustedCallers]
#endif
-#if SIGNED
[assembly: InternalsVisibleTo("Google.Protobuf.Test, PublicKey=" +
"002400000480000094000000060200000024000052534131000400000100010025800fbcfc63a1" +
"7c66b303aae80b03a6beaa176bb6bef883be436f2a1579edd80ce23edf151a1f4ced97af83abcd" +
"981207041fd5b2da3b498346fcfcd94910d52f25537c4a43ce3fbe17dc7d43e6cbdb4d8f1242dc" +
"b6bd9b5906be74da8daa7d7280f97130f318a16c07baf118839b156299a48522f9fae2371c9665" +
"c5ae9cb6")]
-#else
-[assembly: InternalsVisibleTo("Google.Protobuf.Test")]
-#endif
-
-[assembly: AssemblyVersion("3.0.0.0")]
-[assembly: AssemblyFileVersion("3.0.0.0")]
-[assembly: AssemblyInformationalVersion("3.0.0-beta4")]
diff --git a/csharp/src/Google.Protobuf/packages.config b/csharp/src/Google.Protobuf/packages.config
deleted file mode 100644
index 40b8fd927..000000000
--- a/csharp/src/Google.Protobuf/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/project.json b/csharp/src/Google.Protobuf/project.json
new file mode 100644
index 000000000..c8eae6d0b
--- /dev/null
+++ b/csharp/src/Google.Protobuf/project.json
@@ -0,0 +1,65 @@
+{
+ "version": "3.0.0-beta4",
+ "title": "Google Protocol Buffers",
+ "description": "See project site for more info.",
+ "authors": [ "Google Inc." ],
+ "copyright": "Copyright 2015, Google Inc.",
+
+ "packOptions": {
+ "summary": "C# runtime library for Protocol Buffers - Google's data interchange format.",
+ "tags": [ "Protocol", "Buffers", "Binary", "Serialization", "Format", "Google", "proto", "proto3" ],
+ "owners": [ "protobuf-packages" ],
+ "licenseUrl": "https://github.com/google/protobuf/blob/master/LICENSE",
+ "projectUrl": "https://github.com/google/protobuf",
+ "releaseNotes": "C# proto3 support",
+ "requireLicenseAcceptance": false,
+ "repository": {
+ "url": "https://github.com/nodatime/nodatime.git"
+ }
+ },
+
+ "buildOptions": {
+ "debugType": "portable",
+ "keyFile": "../../keys/Google.Protobuf.snk",
+ "xmlDoc": true
+ },
+
+ "configurations": {
+ "Debug": {
+ "buildOptions": {
+ "define": [ "DEBUG", "TRACE" ]
+ }
+ },
+ "Release": {
+ "buildOptions": {
+ "define": [ "RELEASE", "TRACE" ],
+ "optimize": true
+ }
+ }
+ },
+
+ "frameworks": {
+ // This target allows the package to be installed in a .NET 4.5+
+ // project without asking for myriad other dependencies.
+ "net45": {
+ },
+ "netstandard1.0": {
+ "dependencies": {
+ "System.Collections": "4.0.11",
+ "System.Diagnostics.Debug": "4.0.11",
+ "System.Globalization": "4.0.11",
+ "System.IO": "4.1.0",
+ "System.Linq": "4.1.0",
+ "System.Linq.Expressions": "4.1.0",
+ "System.ObjectModel": "4.0.12",
+ "System.Reflection": "4.1.0",
+ "System.Reflection.Extensions": "4.0.1",
+ "System.Runtime": "4.1.0",
+ "System.Runtime.Extensions": "4.1.0",
+ "System.Text.Encoding": "4.0.11",
+ "System.Text.RegularExpressions": "4.1.0",
+ "System.Threading": "4.0.11"
+ }
+ }
+ }
+}
diff --git a/jenkins/docker/Dockerfile b/jenkins/docker/Dockerfile
index 8467aeff5..c928ac71a 100644
--- a/jenkins/docker/Dockerfile
+++ b/jenkins/docker/Dockerfile
@@ -23,6 +23,13 @@ run echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /e
echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
+# Install dotnet SDK based on https://www.microsoft.com/net/core#debian
+# (Ubuntu instructions need apt to support https)
+RUN apt-get update && apt-get install -y curl libunwind8 gettext && \
+ curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=809130 && \
+ mkdir -p /opt/dotnet && tar zxf dotnet.tar.gz -C /opt/dotnet && \
+ ln -s /opt/dotnet/dotnet /usr/local/bin
+
# Install dependencies. We start with the basic ones require to build protoc
# and the C++ build
RUN apt-get update && apt-get install -y \
diff --git a/tests.sh b/tests.sh
index 72465a7b0..99e5df4ea 100755
--- a/tests.sh
+++ b/tests.sh
@@ -57,15 +57,27 @@ build_csharp() {
if [ "$TRAVIS" == "true" ]; then
# Install latest version of Mono
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
+ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1397BC53640DB551
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
- echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | sudo tee -a /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update -qq
sudo apt-get install -qq mono-devel referenceassemblies-pcl nunit
- wget www.nuget.org/NuGet.exe -O nuget.exe
- NUGET=../../nuget.exe
+
+ # Then install the dotnet SDK as per Ubuntu 14.04 instructions on dot.net.
+ sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
+ sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
+ sudo apt-get update -qq
+ sudo apt-get install -qq dotnet-dev-1.0.0-preview2-003121
fi
- (cd csharp/src; mono $NUGET restore)
+ # Perform "dotnet new" once to get the setup preprocessing out of the
+ # way. That spews a lot of output (including backspaces) into logs
+ # otherwise, and can cause problems. It doesn't matter if this step
+ # is performed multiple times; it's cheap after the first time anyway.
+ mkdir dotnettmp
+ (cd dotnettmp; dotnet new > /dev/null)
+ rm -rf dotnettmp
+
+ (cd csharp/src; dotnet restore)
csharp/buildall.sh
cd conformance && make test_csharp && cd ..
}