C# SDK Introduction
The C# SDK leverages the power of .NET to help you create robust and feature-rich plugins for Logitech devices. This guide walks you through setting up your development environment and building your first plugin using the Logi Actions SDK for C#.
New to the Logi Actions SDK? Start with the Getting Started guide to learn about supported devices, choose between C# and Node.js SDKs, and understand the ecosystem.
Prerequisites
Before you begin, ensure you have:
- Basic knowledge of .NET and C# development
- A code editor or IDE supporting .NET development (e.g., Visual Studio Code, Visual Studio 2022 Community Edition or higher, or JetBrains Rider)
For general prerequisites including host applications and supported devices, see the Getting Started guide.
Installation and First Build
The following steps guide you through installing the required tools and creating a working C# plugin project.
-
Install the host application. Ensure you have the latest Logitech Options+ or Loupedeck software installed:
- Logitech Options+: https://www.logitech.com/software/logi-options-plus.html
- Loupedeck: https://loupedeck.com/downloads/
noteInstalling a host application also installs the Logi Plugin Service application, which manages and runs plugins.
-
Install the .NET 8 SDK. Download it from https://dotnet.microsoft.com/download/dotnet/8.0
-
Install Logi Plugin Tool. Open a terminal and run the following command to install the
LogiPluginToolpackage as a .NET tool:dotnet tool install --global LogiPluginToolnoteLogi Plugin Tool is a command-line tool that allows you to create C# plugin projects, package plugins for distribution, and verify plugin packages.
-
Generate a plugin project. Use the Logi Plugin Tool to create a new plugin project:
logiplugintool generate Examplewhere "Example" is the name of the plugin. The command creates a folder named
ExamplePluginin the current directory. -
Build the plugin. Navigate to the generated folder and build the solution:
cd ExamplePlugin
dotnet build -
Verify the build output. Confirm that the build produces a
.linkfile in the Logi Plugin Service Plugins directory:- Windows
- macOS
C:\Users\USERNAME\AppData\Local\Logi\LogiPluginService\Plugins\ExamplePlugin.link/Users/USERNAME/Library/Application Support/Logi/LogiPluginService/Plugins/ExamplePlugin.linknoteThe
.linkfile tells the Logi Plugin Service where to find your plugin during development. When the plugin project is built, this file is updated to point to the build output directory. When the.linkfile exists, the plugin is loaded from the location specified in the file. -
Test the plugin. Launch Logitech Options+ or Loupedeck software and wait for the configuration UI to appear.
-
In the Logitech Options+ software, open the customization view for Actions Ring, MX Creative Keypad, or MX Creative Dialpad device. Then navigate to "All Actions" and verify that the "Example" plugin appears under the "Installed Plugins" section. If the plugin is not shown on the list, go to the Options+ settings and select "Restart Logi Plugin Service".
-
In the Loupedeck software, unhide the "Example" plugin on the "Show and hide plugins" tab of the Action Panel. The plugin should be now shown in the UI.
-
Hot Reloading
You can optionally use the .NET Hot Reload feature to automatically rebuild the plugin project and reload the plugin in the host application whenever a source code file is saved.
To start hot reloading, first navigate to the plugin project's src directory, then run the watch command:
- Windows
- macOS
cd ExamplePlugin\src\
dotnet watch build
cd ExamplePlugin/src/
dotnet watch build
More information about .NET Hot Reload: https://devblogs.microsoft.com/dotnet/introducing-net-hot-reload/