-
-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
3cxc edited this page Sep 12, 2026
·
3 revisions
| Component | Minimum |
|---|---|
| .NET SDK | 8.0 |
| OS (host) | Windows (x64) |
| Runtime | .NET NativeAOT (plugin-side) |
Plugins are compiled with
PublishAot=trueand must export unmanaged entry points. The host must also be built with NativeAOT or contain the CLR if loading non-AOT plugins.
<PackageReference Include="NativePluginKit" Version="1.0.0" />If you are working inside the same solution:
<ProjectReference Include="..\NativePluginKit\NativePluginKit.csproj" />git submodule add https://github.com/GoWelkinDev/NativePluginKit.gitIn your client's initialization code, build a HostApiTable and create a PluginLoader:
using NativePluginKit.Loader;
using NativePluginKit.Loader.Constants;
var api = HostApiBridgeBuilder.Create(
transition: (scenePathPtr, fadeOut) => { /* ... */ },
printLog: (messagePtr) => { /* ... */ }
);
var loader = new PluginLoader(
logAction: msg => Console.WriteLine(msg),
apiTable: api,
apiVersion: new Version(1, 0, 0)
);
loader.LoadPluginsFromDirectory(
Path.Combine(AppContext.BaseDirectory, "plugins")
);-
Create a new Class Library targeting
net8.0. -
Add the following to the
.csproj:<PublishAot>true</PublishAot> <NativeLib>Shared</NativeLib> <IlcExportUnmanagedEntrypoints>true</IlcExportUnmanagedEntrypoints> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
-
Reference
NativePluginKit(see above). -
Add a class inheriting from
Plugin(see the tutorial). -
Build the plugin:
dotnet publish -c Release -r win-x64
-
Copy the resulting
YourPlugin.dllinto the host'splugins/folder.