Skip to content

Create Plugin Metadata ​

The loader needs to know a plugin's name, version, and dependencies. We call this information metadata.

Add ExampleMetaData.cs to the SDK and derive it from BasePluginMetaData. The base class provides the common fields; here we'll add authors and a website:

ExampleMetaData.cs
csharp
using ShadowPluginLoader.Attributes;
using ShadowPluginLoader.WinUI;

namespace ShadowExample.Core.Plugins;

[ExportMeta]
public record ExampleMetaData : BasePluginMetaData
{
    [Meta(Required = false)]
    public string[] Authors { get; init; } = [];

    [Meta(Required = false)]
    public string? Url { get; init; }
}

[ExportMeta] tells the build tool to generate plugin.d.json from this class. Choose one metadata class per SDK for this attribute.

Fields you already have ​

These properties are ready to use:

PropertyTypeWhat it describes
Id / NamestringThe plugin's unique identifier and name
VersionNuGetVersionPlugin version, written as a JSON string
SdkVersionVersionRangeSupported SDK versions
PriorityintDefaults to 0; smaller numbers load earlier, with dependencies loaded first
DependenciesPluginDependency[]Required plugins and their version ranges
DllNamestringAssembly name without .dll
BuiltInboolWhether the plugin is built in; set with [MainPlugin(BuiltIn = true)]
RawJsonElementThe original JSON information
MainPluginTypeThe plugin's main class
EntryPointsPluginEntryPointType[]Additional entry points provided by the plugin

You usually don't need to fill in SdkVersion. For an SDK assembly version of 1.3.1.0, the tool supplies [1.3, 1.4), allowing the 1.3 series. The loader checks this range for compatibility.

Add your own fields ​

Add properties and mark them with [Meta], just like Authors and Url above. Usually you'll use { get; init; }. Arrays and nested objects work too. Give optional properties a default value or make them nullable with ?.

Here are the common Meta settings:

SettingDefaultWhat it does
RequiredtrueMakes the field mandatory
ExcludefalseLeaves the field out of the metadata definition
RegexnullChecks a string against a regular expression
AsStringfalseDescribes the field as a string in the definition
ConverternullSets a System.Text.Json converter type with a parameterless constructor

AsString only changes the definition. If your custom type needs conversion from a string, provide a converter too. Versions and dependencies already have built-in support.

See Create a Plugin to fill in these fields, or Entry Points to expose additional classes.