Pop.Plugins is a lightweight and extensible plugin framework for .NET 8+ that enables runtime discovery and loading of modular plugins (DLLs) into your .NET applications — including Console apps, Web APIs, or Background Services.
| Package | Description |
|---|---|
Pop.Plugins.Abstractions |
Interfaces and base types required to implement plugins |
Pop.Plugins.DependencyInjection.Abstractions |
Abstractions for plugin DI container |
Pop.Plugins.Logging |
Logging configuration helpers for plugin-specific log categories |
Pop.Plugins.Logging.Abstractions |
Logging abstractions for plugin logging |
Pop.Plugins.Runtime |
Plugin loader and runtime manager for loading/unloading plugins |
Required NuGet packages:
- Microsoft.Extensions.Caching.Memory (for service resolution caching)
- Microsoft.Extensions.DependencyInjection (for DI)
- Microsoft.Extensions.Options (for options/configuration)
- All public and internal APIs are documented with XML comments (in English).
- See source code for inline documentation of types, methods, parameters, and return values.
builder.Services.AddPluginManager(options =>
{
options.PluginsFolder = Path.Combine(AppContext.BaseDirectory, "Plugins");
options.PluginFilter = dllPath => Path.GetFileName(dllPath).Contains("Plugin.");
options.AutoLoadPlugins = true;
},
configure: pluginManager =>
{
pluginManager.RegisterSharedServices(services =>
{
services.AddSingleton<IMyService, MyService>();
});
});Create a class library project and reference Pop.Plugins.Abstractions. Then implement your plugin:
public class MyPlugin : PluginBase
{
public MyPlugin(IPluginLoggingConfigurator pluginLoggerConfigurator, PluginSettings pluginSettings)
: base(pluginLoggerConfigurator, pluginSettings)
{
}
public override void ConfigurePluginServices()
{
Services.AddSingleton<IMyPluginService, MyPluginService>();
}
public override void ConfigureHostServices(IServiceCollection services)
{
services.AddTransient<IMyPluginService, MyPluginService>();
}
}- Place a JSON settings file next to your plugin DLL (e.g.,
MyPlugin.settings.json). - The framework will automatically load settings using
PluginConfigurationLoader.
- Build your plugin project
- Copy the resulting
.dlland.settings.jsoninto the plugins/ folder of your host application - On next run, it will be automatically loaded
- Automatic loading of plugin configuration from JSON
- Custom
AssemblyLoadContextper plugin for isolation - Optional shared service registration
- Per-plugin dependency injection container
- Plugin-scoped logging (
ILogger<MyService>uses plugin category) - Plugin unload support (experimental)
- Service resolution with caching (
PluginServiceResolver)
- Document your public APIs with XML comments
- Implement your plugin by inheriting from
PluginBaseorIPlugin - Register host/shared services in
ConfigureHostServices - Register plugin-specific services in
ConfigurePluginServices - Use
PluginSettingsfor configuration andPluginLoggingSettingsfor logging
- All types, methods, and parameters are documented in source code with XML comments
- See source for details on:
IPluginIPluginManagerPluginBasePluginConfigurationLoaderPluginLoadContextPluginManagerPluginServiceResolver
- Ensure all new code is covered by XML documentation
- Follow .NET coding conventions and document all public/internal APIs
- Fork the repository and create a feature branch
- Submit pull requests with clear descriptions
MIT License
For issues, feature requests, or questions, open a GitHub issue or contact the maintainer.