Extensions.Hosting.Wpf.Bootstrap 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Extensions.Hosting.Wpf.Bootstrap --version 2.0.0                
NuGet\Install-Package Extensions.Hosting.Wpf.Bootstrap -Version 2.0.0                
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="Extensions.Hosting.Wpf.Bootstrap" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Extensions.Hosting.Wpf.Bootstrap --version 2.0.0                
#r "nuget: Extensions.Hosting.Wpf.Bootstrap, 2.0.0"                
#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 Extensions.Hosting.Wpf.Bootstrap as a Cake Addin
#addin nuget:?package=Extensions.Hosting.Wpf.Bootstrap&version=2.0.0

// Install Extensions.Hosting.Wpf.Bootstrap as a Cake Tool
#tool nuget:?package=Extensions.Hosting.Wpf.Bootstrap&version=2.0.0                

Microsoft.Extensions.Hosting.Wpf.Bootstrap

Extension library for Microsoft.Extensions.Hosting.Wpf. Helps to bootstrap 3rd party Dependency Injections. Not necessary to use, you can register your 3rd DI dependencies also in ConfigureServices just like with Microsoft Dependency Injection, it has more of decorative role.

Getting Started

Install nuget

Install-Package Extensions.Hosting.Bootstrap

Example usage with SimpleInjector

public class RootBoot : IBootstrap<Container>
{
	private readonly ILogger<RootBoot> _logger;

	public RootBoot(ILogger<RootBoot> logger)
	{
		_logger = logger;
	}

	public void Boot(Container container, Assembly[] assemblies)
	{
		_logger.LogInformation("SimpleInjector registration.");
		container.Register<MainViewModel>(Lifestyle.Transient); //<-- register things to SimpleInjector
	}

	public static Container CreateContainer()
	{
		return new Container
		{
			Options =
			{
				EnableAutoVerification = false,
				DefaultScopedLifestyle = new AsyncScopedLifestyle()
			}
		};
	}
}
public static void Main(string[] args)
{
	using var container = RootBoot.CreateContainer(); // <-- new line
	using var viewModelContainer = new SimpleInjectorViewModelContainer(container);
	using IHost host = CreateHostBuilder(container, args)
		.Build()
		.UseSimpleInjector(container) // <-- new line(specific to SimpleInjector)
		.UseWpfContainerBootstrap(container) // <-- new line
		.UseWpfViewModelLocator<App, ViewModelLocator>(viewModelContainer);
	host.Run();
}

private static IHostBuilder CreateHostBuilder(Container container, string[] args)
{
	return Host.CreateDefaultBuilder(args)
		.ConfigureServices((context, collection) => ConfigureServices(context, collection, container));
}

private static void ConfigureServices(HostBuilderContext hostContext, IServiceCollection services, Container container)
{
	services.AddSimpleInjector(container, options =>{}); //<-- new line(specific to SimpleInjector)
	services.AddBootstrap<Container, RootBoot>(); // <-- new line
	services.AddWpf<App>();
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net6.0-windows7.0 is compatible.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.4.0 253 11/23/2023
3.3.0 250 3/8/2023
3.2.0 243 2/7/2023
3.1.0 276 1/26/2023
3.0.0 396 6/24/2022
2.0.0 432 6/8/2022