This section describes how to set up a .NET Framework native client development environment using C# and CMake.
This walkthrough assumes that certain components are in place:
The GemFire Native Client libraries. Install the Native Client as described in Getting Started with the Native Library. Follow the ease-of-use recommendations by installing the Native Client in C:\Program Files\nativeclient
.
The CMake tool suite. Download and install CMake, following the instructions on cmake.org.
Geode: Install and configure Geode. See the Geode User’s Guide for instructions and system requirements.
Visual Studio 2015 or higher and .NET Framework 4.5.2.
To develop a Native Client application using .NET Framework and CMake:
Create a project directory structure. In this example, the project is called MyProject. The directory structure provides a place for your application source files and a cmake
modules directory for project-specific CMake files:
MyProject\
cmake\
FindGemFireNative.cmake
CMakeLists.txt
Program.cs
Change directory to MyProject and create your application sources. In this example, we have one source file, Program.cs
.
Copy the FindGemFireNative.cmake
script from one of the Native Client examples to the cmake
subdirectory.
Create CMakeLists.txt. Copy the file from an example, if you like, as a starting point. The CMakeLists.txt file should contain the following CMake instructions:
cmake_minimum_required(VERSION 3.10)
project(MyProject LANGUAGES CSharp)
FindGemFireNative.cmake
script is located and an instruction telling CMake to use it:set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
find_package(GemFireNative REQUIRED COMPONENTS dotnet)
add_executable(MyProject Program.cs)
target_link_libraries(MyProject
PUBLIC
GemFireNative::dotnet)
set_target_properties(MyProject PROPERTIES
VS_DOTNET_TARGET_FRAMEWORK_VERSION "v4.5.2"
VS_DOTNET_REFERENCES "System;{GemFireNative_DOTNET_LIBRARY})
Combined, the above elements comprise the following CMakeLists.txt:
# CMakeLists.txt for .NET Framework Native Client App
cmake_minimum_required(VERSION 3.10)
project(MyProject LANGUAGES CSharp)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
find_package(GemFireNative REQUIRED COMPONENTS dotnet)
add_executable(MyProject Program.cs)
target_link_libraries(MyProject
PUBLIC
GemFireNative::dotnet)
set_target_properties(MyProject PROPERTIES
VS_DOTNET_TARGET_FRAMEWORK_VERSION "v4.5.2"
VS_DOTNET_REFERENCES "System;${GemFireNative_DOTNET_LIBRARY}")
Create a build directory and set it as your current directory:
$ mkdir build
$ cd build
Run CMake to configure the build:
$ cmake ..
This creates a Visual Studio solution for your .NET Framework application. For example, MyProject.sln
.
Open the solution file in Visual Studio and build the project.