![]() |
VOOZH | about |
dotnet add package CP.Extensions.Hosting.ReactiveUI.WinUI --version 3.1.26
NuGet\Install-Package CP.Extensions.Hosting.ReactiveUI.WinUI -Version 3.1.26
<PackageReference Include="CP.Extensions.Hosting.ReactiveUI.WinUI" Version="3.1.26" />
<PackageVersion Include="CP.Extensions.Hosting.ReactiveUI.WinUI" Version="3.1.26" />Directory.Packages.props
<PackageReference Include="CP.Extensions.Hosting.ReactiveUI.WinUI" />Project file
paket add CP.Extensions.Hosting.ReactiveUI.WinUI --version 3.1.26
#r "nuget: CP.Extensions.Hosting.ReactiveUI.WinUI, 3.1.26"
#:package CP.Extensions.Hosting.ReactiveUI.WinUI@3.1.26
#addin nuget:?package=CP.Extensions.Hosting.ReactiveUI.WinUI&version=3.1.26Install as a Cake Addin
#tool nuget:?package=CP.Extensions.Hosting.ReactiveUI.WinUI&version=3.1.26Install as a Cake Tool
NOTE: The namespacing has been changed to ReactiveMarbles.Extensions.Hosting. Please update your references to the new namespace.
Extensions for Microsoft.Extensions.Hosting that bring WPF, WinForms, WinUI, ReactiveUI, plug-ins, single-instance control, and common host utilities to desktop apps.
This repository supports both classic IHostBuilder and the newer IHostApplicationBuilder hosting model introduced in .NET 8+. Existing IHostBuilder APIs remain unchanged; equivalent IHostApplicationBuilder overloads are available where appropriate.
Supported targets include .NET Framework 4.6.2/4.8, .NET Standard 2.0, and .NET 8/9/10 (Windows where applicable).
Choose a hosting model:
using Microsoft.Extensions.Hosting;
using ReactiveMarbles.Extensions.Hosting.Wpf;
var host = Host.CreateDefaultBuilder(args)
.ConfigureWpf(wpf =>
{
// Optional: register Application type and windows via the WpfBuilder
wpf.ApplicationType = typeof(App);
wpf.WindowTypes.Add(typeof(MainWindow));
wpf.ConfigureContextAction = ctx => ctx.ShutdownMode = ShutdownMode.OnMainWindowClose;
})
.UseWpfLifetime(ShutdownMode.OnMainWindowClose)
.Build();
await host.RunAsync();
using Microsoft.Extensions.Hosting;
using ReactiveMarbles.Extensions.Hosting.Wpf;
var builder = Host.CreateApplicationBuilder(args)
.ConfigureWpf(wpf =>
{
wpf.ApplicationType = typeof(App);
wpf.WindowTypes.Add(typeof(MainWindow));
wpf.ConfigureContextAction = ctx => ctx.ShutdownMode = ShutdownMode.OnMainWindowClose;
})
.UseWpfLifetime(ShutdownMode.OnMainWindowClose);
await builder.Build().RunAsync();
The following sections outline the main features, their APIs for both hosting models, and example usage.
Namespace: ReactiveMarbles.Extensions.Hosting.Wpf
Example (builder model): see Quick start above.
Namespace: ReactiveMarbles.Extensions.Hosting.WinForms
Example (application builder):
using Microsoft.Extensions.Hosting;
using ReactiveMarbles.Extensions.Hosting.WinForms;
var builder = Host.CreateApplicationBuilder(args)
.ConfigureWinForms(ctx =>
{
ctx.EnableVisualStyles = true;
})
.ConfigureWinFormsShell<MainForm>()
.UseWinFormsLifetime();
await builder.Build().RunAsync();
Namespace: ReactiveMarbles.Extensions.Hosting.WinUI
Example (application builder):
using Microsoft.Extensions.Hosting;
using ReactiveMarbles.Extensions.Hosting.WinUI;
var builder = Host.CreateApplicationBuilder(args)
.ConfigureWinUI<App, MainWindow>();
await builder.Build().RunAsync();
Namespaces: ReactiveMarbles.Extensions.Hosting.ReactiveUI (per UI stack)
Example (WPF + ReactiveUI with application builder):
using Microsoft.Extensions.Hosting;
using ReactiveMarbles.Extensions.Hosting.ReactiveUI;
using ReactiveMarbles.Extensions.Hosting.Wpf;
var builder = Host.CreateApplicationBuilder(args)
.ConfigureSplatForMicrosoftDependencyResolver()
.ConfigureWpf(wpf =>
{
wpf.ApplicationType = typeof(App);
wpf.WindowTypes.Add(typeof(MainWindow));
})
.UseWpfLifetime();
await builder.Build().RunAsync();
Namespace: ReactiveMarbles.Extensions.Hosting.Plugins
Example (application builder):
using Microsoft.Extensions.Hosting;
using ReactiveMarbles.Extensions.Hosting.Plugins;
var builder = Host.CreateApplicationBuilder(args)
.ConfigurePlugins(plugins =>
{
plugins.UseContentRoot = true;
// Add framework assemblies and plugin patterns
plugins.IncludeFrameworks(@"\\netstandard2.0\\*.FrameworkLib.dll");
plugins.IncludePlugins(@"\\Plugins\\{runtime}\\ReactiveMarbles.Plugin.*.dll");
});
await builder.Build().RunAsync();
Namespace: ReactiveMarbles.Extensions.Hosting.AppServices
Example (application builder):
using Microsoft.Extensions.Hosting;
using ReactiveMarbles.Extensions.Hosting.AppServices;
var builder = Host.CreateApplicationBuilder(args)
.ConfigureSingleInstance(cfg =>
{
cfg.MutexId = "{ea031523-3a63-45e5-85f2-6fa75fbf37ed}";
cfg.WhenNotFirstInstance = (env, logger) =>
logger.LogWarning("Application {0} already running.", env.ApplicationName);
});
await builder.Build().RunAsync();
Namespace: ReactiveMarbles.Extensions.Hosting.PluginService
Example (service/console dual mode using IHostApplicationBuilder):
using Microsoft.Extensions.Hosting;
using ReactiveMarbles.Extensions.Hosting.PluginService;
var builder = Host.CreateApplicationBuilder(args)
.UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureLogging()
.ConfigureConfiguration(args)
.UseConsoleLifetime(); // or .UseServiceBaseLifetime() for Windows Service
await builder.Build().RunAsync();
Example (helper):
using ReactiveMarbles.Extensions.Hosting.PluginService;
await ServiceHost.CreateApplication(
typeof(Program),
args,
hb => hb // external builder customization
.ConfigurePlugins(pb =>
{
/* plugin globs */
pb.RequirePlugins(true); // fail if none found - optional default false
}),
host => { /* use host.Services */ },
nameSpace: "ReactiveMarbles.Plugin");
Namespaces:
APIs (service collection extensions used inside UseWebHostServices):
Host/web host wiring:
Example:
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using ReactiveMarbles.Extensions.Hosting.Identity.EntityFrameworkCore;
var host = Host.CreateDefaultBuilder(args)
.UseWebHostServices((whb, services) =>
{
services.UseEntityFrameworkCoreSqlServer<AppDbContext, IdentityUser, IdentityRole>(whb, "DefaultConnection");
})
.Build();
await host.RunAsync();
var builder = Host.CreateApplicationBuilder(args)
.ConfigureSplatForMicrosoftDependencyResolver()
.ConfigureWpf(wpf =>
{
wpf.ApplicationType = typeof(App);
wpf.WindowTypes.Add(typeof(MainWindow));
})
.UseWpfLifetime()
.ConfigureSingleInstance("{ea031523-3a63-45e5-85f2-6fa75fbf37ed}");
await builder.Build().RunAsync();
.ConfigurePlugins(pluginBuilder =>
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("Running using dotNet {0}", Environment.Version);
var process = Process.GetCurrentProcess();
var fullPath = process.MainModule?.FileName?.Replace(process.MainModule.ModuleName!, string.Empty);
Console.WriteLine("Add Scan Directories: {0}", fullPath);
pluginBuilder?.AddScanDirectories(fullPath!);
pluginBuilder?.IncludeFrameworks(@"\netstandard2.0\*.FrameworkLib.dll");
var runtime = Path.GetFileName(AppContext.BaseDirectory);
Console.WriteLine(@"Include Plugins from: \Plugins\{0}\{1}*.dll", runtime, "ReactiveMarbles.Plugin");
pluginBuilder?.IncludePlugins(@$"\Plugins\{runtime}\{{YourPluginNamespace}}*.dll");
Console.ResetColor();
})
await ServiceHost.Create(
typeof(Program),
args,
hb => hb, // Configure the HostBuilder
host => {}, // Configure the Host
nameSpace: "ReactiveMarbles.Plugin").ConfigureAwait(false);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows10.0.19041 net8.0-windows10.0.19041 is compatible. net9.0-windows net9.0-windows was computed. net9.0-windows10.0.19041 net9.0-windows10.0.19041 is compatible. net10.0-windows net10.0-windows was computed. net10.0-windows10.0.19041 net10.0-windows10.0.19041 is compatible. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.1.26 | 175 | 5/5/2026 |
| 3.1.6 | 145 | 4/21/2026 |
| 3.1.2 | 104 | 4/21/2026 |
| 3.0.9 | 122 | 4/9/2026 |
| 3.0.6 | 144 | 3/12/2026 |
| 3.0.4 | 128 | 3/8/2026 |
| 3.0.0-beta.10 | 80 | 1/22/2026 |
| 2.3.15 | 736 | 12/2/2025 |
| 2.3.13 | 720 | 12/1/2025 |
| 2.3.4 | 253 | 11/3/2025 |
| 2.3.3 | 245 | 11/3/2025 |
| 2.2.2 | 258 | 9/10/2025 |
| 2.1.13 | 304 | 4/29/2025 |
| 2.1.10 | 274 | 3/16/2025 |
| 2.1.8 | 229 | 2/19/2025 |
| 2.1.6 | 239 | 2/9/2025 |
| 2.1.4 | 225 | 11/21/2024 |
| 2.0.5 | 271 | 5/18/2024 |
| 1.5.2 | 253 | 5/17/2024 |
| 1.4.2 | 282 | 5/5/2024 |
Compatability with Net 8 / 9 / 10 and net462 / net472 / net481