AlexBins.Hosting.Wpf
2.1.1
dotnet add package AlexBins.Hosting.Wpf --version 2.1.1
NuGet\Install-Package AlexBins.Hosting.Wpf -Version 2.1.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AlexBins.Hosting.Wpf" Version="2.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AlexBins.Hosting.Wpf --version 2.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AlexBins.Hosting.Wpf, 2.1.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AlexBins.Hosting.Wpf as a Cake Addin #addin nuget:?package=AlexBins.Hosting.Wpf&version=2.1.1 // Install AlexBins.Hosting.Wpf as a Cake Tool #tool nuget:?package=AlexBins.Hosting.Wpf&version=2.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Hosting.Wpf
What is it used for?
This library adds WPF support to Microsoft.Extensions.Hosting.
How do I use it?
You configure your host to use WPF and add Window instances as required. Then you use the provided extension method to run the application.
class Program {
static int Main(string[] args) {
var builder = new HostBuilder()
.AddWpf<App>()
.UseSerilog((ctx, svc, config) =>
config
.WriteTo.Console()
.Enrich.FromLogContext()
.MinimumLevel.Debug())
.ConfigureServices((ctx, svc) =>
{
// Services registered as Window will be shown on app start
svc.AddSingleton<Window, MainWindow>();
});
var host = builder.Build();
var logger = host.Services.GetRequiredService<ILogger<Program>>();
try
{
await host.RunAsync();
}
catch (Exception ex)
{
logger.LogCritical(ex, "Host terminated unexpectedly");
return -1;
}
return 0;
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0-windows7.0 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0-windows7.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.