To develop a .Net application that uses LibCecSharp:
- download the latest binary version from our website
- add a reference to
LibCecSharp.dll. It's installed toC:\Program Files (x86)\Pulse-Eight\USB-CEC Adapter\net8.0by default - the minimum .Net version required for LibCecSharp is 8.0.
LibCecSharpis now a single pure-C# assembly (namespaceCecSharp) — the old C++/CLILibCecSharp(.NET Framework) andLibCecSharpCore(net8.0) wrappers have been replaced by this one binding. It also builds and runs on Linux/macOS/Raspberry Pi. - WinForms/WPF apps target
net8.0-windows; console/service apps targetnet8.0 - running a .Net app that uses it needs the .NET 8 Desktop Runtime (the installer offers to install it for you)
An example implementation can be found on Github.
The x64 installer (libcec-x64-<version>.exe) ships an optional "libCEC for
Node.js" component: a prebuilt native N-API addon plus its JavaScript wrapper,
installed to C:\Program Files\Pulse-Eight\USB-CEC Adapter\nodejs. Because the
addon is N-API (ABI-stable) it works with any Node.js >= 16 without recompiling.
Point your app at it (e.g.
require('C:/Program Files/Pulse-Eight/USB-CEC Adapter/nodejs')); the matching
cec.dll sits next to the addon, so no PATH changes are needed. See
src/nodejs/README.md for the API.
The x86 installer does not offer the component at all. Node.js has had no
32-bit Windows build since v23, so there is no node.lib to link a 32-bit addon
against. Use the x64 installer if you need the Node.js binding.
To build the addon yourself from a repo checkout you need Node.js and a C++
toolchain (node-gyp). Point it at libCEC's headers and import library with the
LIBCEC_INCLUDE_DIR / LIBCEC_LIB_DIR environment variables:
cd src\nodejs
set LIBCEC_INCLUDE_DIR=..\..\include
set LIBCEC_LIB_DIR=..\..\build\Release\x64
npm install
create-installer.py does exactly this and stages the result (for x64 builds
only); pass -nn to skip building the Node.js binding.
To compile libCEC on Windows, you'll need the following dependencies:
- cmake 3.12 or newer
- Visual Studio 2022 (v17) or newer (2017 and 2019 are also supported), with the following options selected: Desktop development with C++ and .NET desktop development
- .Net 8.0 SDK
- Python 3.12 or newer, used by the build orchestrator
- To create an installer, you'll need Nullsoft's NSIS
To only compile libCEC, follow these instructions:
git submodule update --init --recursive- run
python windows\create-installer.py -nito build libCEC and LibCecSharp
To develop for libCEC in Visual Studio:
git submodule update --init --recursive- run
python windows\create-installer.py -vs
To build an installer on Windows:
git submodule update --init --recursive- run
python windows\create-installer.py - the installer is stored as
dist\libcec-<arch>-<version>.exe