diff --git a/contrib/ci/scripts/test_z3_examples_cmake.sh b/contrib/ci/scripts/test_z3_examples_cmake.sh
index 679fc4a69..1e75a5701 100755
--- a/contrib/ci/scripts/test_z3_examples_cmake.sh
+++ b/contrib/ci/scripts/test_z3_examples_cmake.sh
@@ -88,8 +88,8 @@ if [ "X${PYTHON_BINDINGS}" = "X1" ]; then
fi
if [ "X${DOTNET_BINDINGS}" = "X1" ]; then
- # Build & Run .NET example
- run_quiet run_non_native_binding dotnet run -p ${Z3_SRC_DIR}/examples/dotnet/dotnet.csproj
+ # Run .NET example
+ run_quiet run_non_native_binding dotnet ${Z3_BUILD_DIR}/dotnet/netcoreapp2.0/dotnet.dll
fi
if [ "X${JAVA_BINDINGS}" = "X1" ]; then
diff --git a/examples/dotnet/dotnet.csproj b/examples/dotnet/dotnet.csproj
index 0dc4ee2ec..7776259ea 100644
--- a/examples/dotnet/dotnet.csproj
+++ b/examples/dotnet/dotnet.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/src/api/dotnet/CMakeLists.txt b/src/api/dotnet/CMakeLists.txt
index 68f7b9335..db5a53259 100644
--- a/src/api/dotnet/CMakeLists.txt
+++ b/src/api/dotnet/CMakeLists.txt
@@ -159,6 +159,10 @@ ADD_DOTNET(${CMAKE_CURRENT_BINARY_DIR}/build/Microsoft.Z3.csproj
PACKAGE Microsoft.Z3
PACK_ARGUMENTS "/p:_DN_CMAKE_CONFIG=$"
)
+ADD_DOTNET(${CMAKE_SOURCE_DIR}/examples/dotnet/dotnet.csproj
+ PLATFORM ${Z3_DOTNET_PLATFORM}
+ CUSTOM_BUILDPROPS "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}"
+ DEPENDS Microsoft.Z3)
add_dependencies(BUILD_Microsoft.Z3 libz3)