Skip to main content

Setup

In this section, we'll prepare the development environment and create the project for our plugin.

Requirements

To follow this guide, you will need:

  • .NET SDK 10.0 or later. Check the installed versions using dotnet --list-sdks.
  • Windows 10 or 11 (x64). Plugins run on the Windows PC where MoBro is installed.
  • MoBro installed on the same machine. It's only needed from Publish and Install onwards.
  • An IDE supporting C#, e.g. JetBrains Rider, Visual Studio or Visual Studio Code.

MoBro Plugin CLI

The MoBro Plugin CLI makes it easy to publish plugins, install them to MoBro for testing and publish them to the marketplace. We'll use it in later steps.

Install the CLI from NuGet using the following command:

dotnet tool install --global MoBro.Plugin.Cli

If it's already installed, update it to the latest version instead:

dotnet tool update --global MoBro.Plugin.Cli
info

The MoBro Plugin CLI is optional.
This guide provides an alternative for every step that uses the CLI, but the CLI makes these steps a lot simpler.


Creating the Project

A plugin is a regular .NET console application. Create a new project named Plugin.Example:

dotnet new console -n Plugin.Example -f net10.0
cd Plugin.Example
Using an IDE

Alternatively, create a new Console Application named Plugin.Example targeting net10.0 in your IDE.

The project contains the following files:

Plugin.Example
├── Plugin.Example.csproj
└── Program.cs

Configuring the Project

Replace the content of the .csproj file with the following configuration:

Plugin.Example/Plugin.Example.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<VersionPrefix>0.0.1</VersionPrefix>
<EnableDynamicLoading>true</EnableDynamicLoading>
<UseAppHost>false</UseAppHost>
<SelfContained>false</SelfContained>
</PropertyGroup>

<ItemGroup>
<Content Include="mobro_plugin_config.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<PackageReference Include="MoBro.Plugin.SDK" Version="1.2.0" PrivateAssets="all" />
</ItemGroup>
</Project>

Here's what the individual settings are for:

SettingPurpose
VersionPrefixThe version of the plugin. Increase it for every release.
EnableDynamicLoadingAllows MoBro to load the plugin's assembly.
UseAppHost, SelfContainedMoBro loads the plugin's .dll file, so no .exe and no bundled .NET runtime are needed.
Content Include="mobro_plugin_config.json"Copies the plugin's configuration file, which we'll create in the next step, to the build and publish output.
PackageReferenceAdds the MoBro Plugin SDK. PrivateAssets="all" keeps it out of the published plugin, as MoBro already provides it.
note

The project references the mobro_plugin_config.json file, which doesn't exist yet. Building the project fails until we create it in the next step.

tip

Check NuGet for the latest version of the SDK.