Skip to content

Create a Plugin

This page explains how to create, configure, and package a SecRandom plugin project. Before starting, set up your environment following Set Up a Plugin Environment.

Using the example repository SECTL/SecRandom-ExamplePlugins as a reference, a plugin project usually contains:

ExamplePlugin
├─ SecRandom.ExamplePlugin.csproj // Project file: SDK reference, CreateSrpx enabled
├─ manifest.yml // Plugin manifest
├─ Plugin.cs // Plugin entry class (inherits PluginBase)
├─ PluginStateStore.cs // Reads/writes the plugin's own data in its config folder
├─ README.md // Plugin readme (rendered in the settings page)
├─ icon.png // Plugin icon
├─ Views/
│ └─ SettingsPages/
│ └─ ExampleSettingsPage.axaml(.cs) // Example settings page
└─ srpx/
└─ SecRandom.ExamplePlugin.srpx // Build output (when CreateSrpx=true)

The plugin project needs to:

  • Reference SecRandom.PluginSdk with PackageReference and ExcludeAssets="runtime;native" (see Set Up a Plugin Environment).
  • Set <CreateSrpx>true</CreateSrpx> so the .srpx package is produced on every build.
  • Build with <EnableDynamicLoading>true</EnableDynamicLoading> to support the isolated load context.
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<EnableDynamicLoading>true</EnableDynamicLoading>
<CreateSrpx>true</CreateSrpx>
</PropertyGroup>

The manifest file manifest.yml holds the plugin’s basic information. Projects created from the template come pre-configured; just adjust as needed.

The manifest has the following properties:

Property Type Required? Description
id string Yes Unique plugin id; must be a valid file name without path separators
entranceAssembly string Yes Plugin entrance assembly; the PluginBase implementation is looked up in this assembly
apiVersion string Yes Host API version the plugin targets; its major must be at least the host’s PluginApiVersions.Current.Major
name string No Plugin display name
description string No Plugin description
version string No Plugin’s own version, e.g. 1.0.0
author string No Plugin author
url string No Plugin homepage Url
icon string No Plugin icon file name, defaults to icon.png
readme string No Plugin readme file name, defaults to README.md
dependencies array No Plugin-to-plugin dependencies (see Plugin Dependencies)
supportedPlatforms array No Operating systems the plugin supports
permissions array No Permission declarations, e.g. [ui, storage] (see Permissions & Capabilities); omitting it = undeclared = everything allowed

Here is an example manifest:

id: com.example.plugin
name: SecRandom 示例插件
description: 演示 SecRandom 插件 API 的最小示例插件
entranceAssembly: SecRandom.ExamplePlugin.dll
apiVersion: 3.1.0
version: 1.0.0
author: SECTL
permissions:
- ui
- storage

Read the Plugin Entry Class for entry and lifecycle details, see Capabilities for the stable contracts the host exposes, or check SecRandom-ExamplePlugins on GitHub.