> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.stereolabs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.stereolabs.com/_mcp/server.

# Using the ZED C# API on Windows

This section explains how to use the ZED SDK in C# on the Windows platform.

## Getting Started

These packages let you use the ZED stereo camera in C#. The C# API is a wrapper around the ZED SDK which is written in C++ optimized code.

To start using the ZED SDK in C#, you will need to install the following dependencies on your system:

* Visual Studio 2019 or 2022 with C# support (.NET desktop development workload)
* CMake 3.8 or later (for C# support)
* [ZED SDK](https://www.stereolabs.com/developers/release/) (see Installation section)

The C# API relies on two libraries (the C wrapper and the .NET interface), published together on NuGet.org as a single package.

| Package            | Description                                                                                                  | Link                                                                                                           |
| ------------------ | ------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------- |
| **Stereolabs.zed** | Contains the C wrapper of the ZED SDK and a .NET interface that imports the functions from the wrapper in C# | [![NuGet version](https://badge.fury.io/nu/Stereolabs.zed.svg)](https://www.nuget.org/packages/Stereolabs.zed) |

In our [tutorials](https://github.com/stereolabs/zed-sdk/tree/master/tutorials) and [samples](https://github.com/stereolabs/zed-sdk), these packages are automatically downloaded when building the program.
However, the package can be manually added to any C# project within Visual Studio. See the [NuGet documentation](https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-visual-studio).

## Building a sample

We will build a simple tutorial application **Hello ZED** using the ZED SDK and CMake. [CMake](https://cmake.org) is a cross-platform project generation tool. It provides an easy way to build project files that can be used in the compiler environment of your choice. For example, a CMake script can produce Visual Studio project and solution files.

* Download the [ZED Examples](https://github.com/stereolabs/zed-sdk/archive/master.zip) sample code available on our [GitHub](https://github.com/stereolabs/zed-sdk) page. You can also browse our GitHub for additional plugins and sample codes.

* Open cmake-gui.

* In “Where is the source code“, enter the path of the project folder where the CMakeLists.txt is located.

* In “Where to build the binaries“, enter the previous path and add: /build.

* Click on \[*Configure*].

![image](/_fern-files/stereolabs.docs.buildwithfern.com/3132dcd681e20d24a623d3c47774bbe411a83cb6a76f61c5abba0994b8ac37ad/docs/development/images/csharp/cmake_configure.png)

* A dialog window asks you if CMake can create the “build” folder. Say yes.
* Another dialog window will ask you to specify a generator for your project. Choose [Visual Studio](https://visualstudio.microsoft.com/downloads/) in **Win64** and click on \[*Finish*].

![image](/_fern-img/eedac73a3e2f11534dd62530d07d3e12308e46e819fdd55bc87060491ff516c7.webp)

* CMake may take a few seconds to configure the project.
* Click on \[*Generate*] to build the Visual Studio project files.

![image](/_fern-files/stereolabs.docs.buildwithfern.com/0e3974fdf8a343fdc63c59a74a3ef47ac51cf80f1cda575a9df5c4de1ec1f7c6/docs/development/images/csharp/cmake_generate.PNG)

* CMake has now generated your project in the build directory.
  You can directly open the solution by clicking on \[*Open Project*] or by closing the cmake-gui window and opening the **build** folder.

* A Visual Studio solution has been generated. Open **Hello\_ZED.sln** and set it in `Release` mode.

![image](/_fern-img/b8e36b92e77649a902db80ea784bf36d2fe2ec7b79e4db36d666fb7576a47092.webp)

* To run the builds from the *Build* menu or from keyboard shortcuts, set the `Hello_ZED` target as the startup project. In the Solution Explorer,
  right-click the Hello\_ZED project and click **Set As Startup Project**.

![image](/_fern-files/stereolabs.docs.buildwithfern.com/3a0914b1c4f5e890467571c174c4afa6e87cc3d44e3b207a40ae30b70f22a79f/docs/development/images/csharp/startup_project.png)

* You can now edit and compile your program in the Visual Studio IDE. Hit the `Ctrl+F5` key to launch the program.

* When the program is built, the C# interface (*Stereolabs.zed.dll*) and the C wrapper (*sl\_zed\_c.dll*) are automatically added to the build folder, next to the executable file.

![image](/_fern-img/6cf94de7fbf8c9f8175ca3e8465f30ad038405cc4f553b8b2e9ae147a15488bc.webp)

* When deploying the application, make sure that *sl\_zed\_c.dll* and *Stereolabs.zed.dll* are packaged with the executable files, and shipped on a target PC that has the proper ZED SDK version installed.