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": {