.NET Interface

The Ensenso SDK provides a NuGet package Ensenso.NxLib that allows to access the NxLib interface from .NET projects. The implemented interface is almost identical to the C++ version and defines the same basic access functions and constants as well as the NxLibItem, NxLibCommand and NxLibException classes.

By the installation of the package the contained files will be directly added as an extension of your implementation to the source files of your project. After including Namespace Ensenso you can use NxLib’s object oriented interface to access the tree items and execute commands. You can also have a look at the C# example programs to get started more quickly.


The Common Language Infrastructure (CLI) interface is deprecated since EnsensoSDK 3.6 and will be deleted in a future version of the SDK.


The package ships with the EnsensoSDK and is also hosted on nuget.org.

To install the package on windows you can use one of the NuGet client tools: dotnet.exe, nuget.exe or NuGet Package Manager for Visual Studio. For more information about the tools see https://learn.microsoft.com/en-us/nuget/install-nuget-client-tools.

Here you will find detailed installation instructions respectively client tool:

When using the NuGet package from the EnsensoSDK you will need to add the package first to your local nuget repository.

Usage Differences to the C/C++ API

The .NET interface is designed to provide an identical set of functions to the C/C++ world where ever possible, but there are a few minor design changes made for the interface:

  • Function names are UpperCamelCase to match the C# naming conventions

  • Basic access functions and constants are made available within a global, static object named NxLib. Thus all predefined constants for node names, JSON item type, etc. need to be prefixed with “NxLib.”. An additional prefix “NxLib” on general constants has been dropped:


    • NxLib.cmdCapture instead of cmdCapture

    • NxLib.valStereo instead of valStereo

    • NxLib.ItemTypeString instead of NxLibItemTypeString

  • The exception throwing variants of Initialize and Finalize have been dropped to prevent a collision with the Finalize function of C# objects. You can call NxLib.CheckReturnCode with the return code from NxLib.Initialize or NxLib.Finalize to manually throw an NxLibException if the return code was not NxLib.OperationSuccessful.

  • Custom operators for NxLibItem in C# have been removed, because C# would only allow to overload a small subset of the operators defined in the C++ version of NxLibItem.

All other functionality has remained the same as in C/C++. For information on the usage of the NxLibItem, NxLibCommand and NxLibException classes please also refer to the documentation of these classes in the object oriented C++ API.


The .NET interface was primary designed for C#, but it can also be used from Visual Basic .NET, J# or from within any other .NET language. See next section for handling instructions.

Using .NET interface from Visual Basic

In Visual Studio you can access the interface by using project reference or assembly reference.

Using project reference:
  • Add a new C# project to your solution (make sure to use the same target framework as your project)

  • Install the NuGet package Ensenso.NxLib to the new C# project

  • Establish project reference from your project to the new C# project

  • Access the interface members by including namespace Ensenso

Using assembly reference:
  • Create a new C# class library project (make sure to use the same target framework as your project)

  • Install the NuGet package Ensenso.NxLib to the project

  • Build the dll

  • Add the dll to your project by using assembly reference

  • Access the interface members by including namespace Ensenso