LANCommander/LANCommander.Documentation/Plugins/Overview.md
2026-07-28 19:44:59 -05:00

2.7 KiB

sidebar_label sidebar_position
Overview 1

Plugin Development

LANCommander ships a plugin framework that lets you extend both the server and the launcher without modifying the core applications. A plugin is a standard .NET class library that is discovered from a drop-in folder at startup, loaded in isolation, and given the opportunity to register services and hook into the host.

Plugins can, among other things:

  • Add new pages, settings sections, game detail tabs, context menu items, and footer widgets to the launcher UI.
  • Register additional metadata providers on the server.
  • Add custom PowerShell cmdlets and modules to the scripting runtime used during installs.
  • React to host lifecycle events such as game install, launch, exit, and user login.

How it works

The framework is intentionally small and built around a few ideas:

  • Discovery by convention. At startup each host scans its Plugins drop-in folder. Every subfolder is treated as a candidate plugin; the loader looks for an assembly named after the folder (or the single assembly that ships a .deps.json) and reads its [LANCommanderPlugin] assembly attribute.
  • Host targeting. A plugin declares which hosts it supports (Server, Launcher, or both). A plugin that does not target the current host is skipped.
  • Version gating. A plugin can declare a minimum and/or maximum compatible host version. Incompatible plugins are skipped with a warning rather than loaded.
  • Isolation. Each plugin is loaded into its own AssemblyLoadContext so its private dependencies do not collide with the host or with other plugins. Contract assemblies shared with the host (the SDK, DI abstractions, Avalonia) are deferred to the host so shared types keep a single identity.
  • Two-phase lifecycle. Because the host builds its dependency injection container exactly once, plugins participate in two phases: they register services first, then run an asynchronous initialization hook after the container is built. See Getting Started for details.
  • Fault isolation. A plugin that throws during discovery, configuration, or initialization is logged and skipped. A misbehaving plugin cannot crash the host.

Where to go next

  • Getting Started — build, package, and deploy your first plugin.
  • Extension Points — a tour of everything a plugin can extend, with examples.
  • API Reference — the full plugin surface, generated directly from the source.