From c81ee050982ee8e2d6de2ea681df1635a5666611 Mon Sep 17 00:00:00 2001 From: "Christoph M. Wintersteiger" Date: Wed, 2 Nov 2016 13:36:29 +0000 Subject: [PATCH] Fixes for .NET Core build --- src/api/dotnet/Z3Exception.cs | 10 ++++++---- src/api/dotnet/core/README.txt | 9 +++++++++ src/api/dotnet/core/project.json | 3 ++- 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 src/api/dotnet/core/README.txt diff --git a/src/api/dotnet/Z3Exception.cs b/src/api/dotnet/Z3Exception.cs index 71e4fef1a..b0e05900c 100644 --- a/src/api/dotnet/Z3Exception.cs +++ b/src/api/dotnet/Z3Exception.cs @@ -21,11 +21,13 @@ using System; namespace Microsoft.Z3 { - /// - /// The exception base class for error reporting from Z3 - /// + /// + /// The exception base class for error reporting from Z3 + /// +#if !DOTNET_CORE [Serializable] - public class Z3Exception : Exception +#endif + public class Z3Exception : Exception { /// /// Constructor. diff --git a/src/api/dotnet/core/README.txt b/src/api/dotnet/core/README.txt new file mode 100644 index 000000000..72331d7f9 --- /dev/null +++ b/src/api/dotnet/core/README.txt @@ -0,0 +1,9 @@ +Z3 API for .NET Core + +Z3's .NET API uses Code Contracts, which are not included in .NET Core. The +enclosed file called DummyContracts.cs provides stubs for the Code Contracts +functions, so that the API will compile, but not perform any contract +checking. To build this using .NET core, run (in this directory): + +dotnet restore +dotnet build project.json diff --git a/src/api/dotnet/core/project.json b/src/api/dotnet/core/project.json index afe281a50..d54b6877b 100644 --- a/src/api/dotnet/core/project.json +++ b/src/api/dotnet/core/project.json @@ -4,7 +4,8 @@ "debugType": "portable", "emitEntryPoint": false, "outputName": "Microsoft.Z3", - "compile": [ "../*.cs", "*.cs" ] + "compile": [ "../*.cs", "*.cs" ], + "define": ["DOTNET_CORE"] }, "dependencies": { }, "frameworks": {