This guide covers the complete build process for the databento-dotnet project.
-
.NET 8 SDK
- Download: https://dotnet.microsoft.com/download/dotnet/8.0
- Verify:
dotnet --version(should be 8.0 or later)
-
CMake 3.24+
- Download: https://cmake.org/download/
- Verify:
cmake --version
-
C++17 Compiler
- Windows: Visual Studio 2019+ with C++ workload
- Linux: GCC 9+ or Clang 10+
- macOS: Xcode 11+
# Install via Chocolatey (optional)
choco install cmake visualstudio2022buildtools --installargs "--add Microsoft.VisualStudio.Workload.VCTools"
# Or download Visual Studio with C++ Desktop Development workload
# https://visualstudio.microsoft.com/downloads/sudo apt-get update
sudo apt-get install -y cmake build-essential libssl-dev libzstd-dev pkg-config# Install Xcode Command Line Tools
xcode-select --install
# Install dependencies via Homebrew
brew install cmake openssl zstd# Windows
.\build\build-all.ps1 -Configuration Release
# Linux/macOS
./build/build-all.sh --configuration ReleaseThis builds:
- Native C++ library (databento_native)
- All .NET projects (Databento.Client, Databento.Interop)
- All example projects (26+ examples)
# Windows
cd src\Databento.Native
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
# Linux/macOS
cd src/Databento.Native
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .The native library will be automatically copied to:
src/Databento.Interop/runtimes/{RID}/native/
Where {RID} is:
win-x64for Windowslinux-x64for Linuxosx-x64orosx-arm64for macOS
cd ../../.. # Back to root
dotnet restore
dotnet build databento-dotnet.sln -c Release# Windows
dir src\Databento.Interop\runtimes\win-x64\native\databento_native.dll
# Linux
ls -la src/Databento.Interop/runtimes/linux-x64/native/libdatabento_native.so
# macOS
ls -la src/Databento.Interop/runtimes/osx-arm64/native/libdatabento_native.dylibls src/Databento.Client/bin/Release/net8.0/You should see:
Databento.Client.dllDatabento.Interop.dll- Native library (copied)
# Set your API key
export DATABENTO_API_KEY="your-api-key" # Linux/macOS
$env:DATABENTO_API_KEY="your-api-key" # Windows
# Run an example
dotnet run --project examples/LiveStreaming.ExampleWindows:
# Use Visual Studio Developer Command Prompt
# Or specify generator:
cmake .. -G "Visual Studio 17 2022" -A x64Linux/macOS:
# Ensure compiler is in PATH
which gcc
which g++Ensure you have internet access and git installed:
git --versionIf behind a proxy, configure git:
git config --global http.proxy http://proxy:portLinux:
sudo apt-get install libssl-devmacOS:
brew install openssl
export OPENSSL_ROOT_DIR=$(brew --prefix openssl)
cmake .. -DOPENSSL_ROOT_DIR=$OPENSSL_ROOT_DIRWindows: CMake should find OpenSSL via vcpkg or system installation.
Manually copy the library:
# Windows
copy build\native\Release\databento_native.dll src\Databento.Interop\runtimes\win-x64\native\
# Linux
cp build/native/libdatabento_native.so src/Databento.Interop/runtimes/linux-x64/native/
# macOS
cp build/native/libdatabento_native.dylib src/Databento.Interop/runtimes/osx-arm64/native/Ensure native library is present and has correct permissions:
# Linux/macOS
chmod +x src/Databento.Interop/runtimes/*/native/*To clean all build artifacts:
# Windows
.\build\build-native.ps1 -Clean
dotnet clean
# Linux/macOS
./build/build-native.sh --clean
dotnet clean
# Or manually
rm -rf build/native
rm -rf src/Databento.Interop/runtimes
dotnet cleanYou can build for different platforms using Docker or cross-compilation:
# Build Linux binary on Windows via WSL
wsl ./build/build-native.sh
# Build using Docker
docker run -v $(pwd):/src -w /src mcr.microsoft.com/dotnet/sdk:8.0 \
/bin/bash -c "apt-get update && apt-get install -y cmake build-essential && ./build/build-all.sh"# Debug build
cmake .. -DCMAKE_BUILD_TYPE=Debug
# Release with debug symbols
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
# Custom install prefix
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local
# Verbose build
cmake --build . --verbose# Debug build
dotnet build -c Debug
# Release build with symbols
dotnet build -c Release /p:DebugType=portable
# Specific framework
dotnet build -f net8.0To create a NuGet package with all platform binaries:
- Build native libraries for all platforms
- Place them in
src/Databento.Interop/runtimes/{RID}/native/ - Pack:
dotnet pack src/Databento.Client/Databento.Client.csproj -c ReleaseThe NuGet package will include all native libraries.
Example CI build (GitHub Actions workflows to be added):
# Install dependencies
dotnet restore
# Build native (skip on hosted runners, use pre-built)
./build/build-native.sh
# Build .NET
dotnet build --no-restore -c Release
# Run examples (optional verification)
dotnet run --project examples/LiveStreaming.Example
# Pack
dotnet pack --no-build -c ReleaseAfter successful build:
- Run examples: See README.md
- Check API documentation: XML docs are generated in
bin/folders - Review QUICKSTART.md for usage examples