ServiceResolver.GenericHost.SimpleInjector 3.6.4

dotnet add package ServiceResolver.GenericHost.SimpleInjector --version 3.6.4
                    
NuGet\Install-Package ServiceResolver.GenericHost.SimpleInjector -Version 3.6.4
                    
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="ServiceResolver.GenericHost.SimpleInjector" Version="3.6.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ServiceResolver.GenericHost.SimpleInjector" Version="3.6.4" />
                    
Directory.Packages.props
<PackageReference Include="ServiceResolver.GenericHost.SimpleInjector" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ServiceResolver.GenericHost.SimpleInjector --version 3.6.4
                    
#r "nuget: ServiceResolver.GenericHost.SimpleInjector, 3.6.4"
                    
#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.
#:package ServiceResolver.GenericHost.SimpleInjector@3.6.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ServiceResolver.GenericHost.SimpleInjector&version=3.6.4
                    
Install as a Cake Addin
#tool nuget:?package=ServiceResolver.GenericHost.SimpleInjector&version=3.6.4
                    
Install as a Cake Tool

ServiceResolver.GenericHost.SimpleInjector wires ServiceResolver.Ioc.SimpleInjector into Microsoft.Extensions.Hosting's IHostBuilder, replacing the default IServiceProvider with a SimpleInjector-backed one.

Getting started (console / worker apps)

var hostBuilder = Host.CreateDefaultBuilder(args)
    .UseServiceResolver(new SimpleInjectorOptions
    {
        OnRegistering = provider =>
        {
            provider.Register<StringBuilder>(() => new StringBuilder("hello world.."));
        },
        AfterBuildingProvider = provider =>
        {
            provider.Verify();
        }
    });

var host = hostBuilder.Build();

await host.RunAsync();

An overload taking Func<HostBuilderContext, SimpleInjectorOptions> is also available when you need access to configuration or environment during setup.

Getting started (ASP.NET Core, .NET 6+)

Also requires the ServiceResolver.GenericHost.AspNetCore package.

var builder = WebApplication.CreateBuilder(args);

builder.Host.UseServiceResolver(new SimpleInjectorOptions
{
    BeforeRegistering = collection =>
    {
        collection.AddControllers();
    },
    OnRegistering = serviceRegister =>
    {
        serviceRegister
            .AddAspNetCore()
            .AddControllerActivation();
    },
    AfterBuildingProvider = provider =>
    {
        provider.Verify();
    }
});

var app = builder.Build();

app.UseAuthorization();
app.MapControllers();
await app.RunAsync();

Constructor resolution: strict by default, relaxed where it has to be

By default (ConstructorResolutionType = ResolutionType.Hybrid), services registered through IServiceRegister keep SimpleInjector's strict rules (single public constructor, no optional-parameter fallback), while services coming from IServiceCollection (ASP.NET Core, third-party AddXxx() extensions) get a more permissive resolution — because those libraries routinely assume Microsoft's own, more lenient DI conventions. Set ConstructorResolutionType / SuppressDiagnosticType to ResolutionType.Standard (fully strict) or ResolutionType.LessRestrictive (relaxed everywhere) to change this globally.

Main types

  • SimpleInjectorOptions — the configuration passed to UseServiceResolver.

Advanced scenarios that configure the underlying Container directly can use the public types under the ServiceResolver.Ioc.Advanced namespace, such as KeyedConstructorResolverBehavior and KeyedDependencyInjectionBehavior — see the documentation for details.

  • ServiceResolver.GenericHost
  • ServiceResolver.Ioc.SimpleInjector
  • ServiceResolver.GenericHost.AspNetCore (for ASP.NET Core)
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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.  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 is compatible.  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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
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.6.4 0 8/21/2026
3.6.3 40 8/20/2026
3.6.2 37 8/20/2026
3.6.1 2,138 12/1/2025
3.5.2 712 8/6/2025
3.5.1 150 8/3/2025
3.4.2 412 6/24/2025
3.4.1 1,590 3/4/2025
3.4.1-rc2 185 2/27/2025
3.4.1-rc1 171 2/27/2025
3.3.3 293 2/11/2025
3.3.2 424 11/25/2024
3.3.1 540 10/10/2024
3.2.1 271 9/10/2024
3.1.1 267 9/9/2024
2.2.1 1,032 4/5/2024
2.1.1 378 2/28/2024
1.1.1 237 2/8/2024
1.0.1 215 1/26/2024