ServiceResolver.GenericHost.SimpleInjector
3.8.0
dotnet add package ServiceResolver.GenericHost.SimpleInjector --version 3.8.0
NuGet\Install-Package ServiceResolver.GenericHost.SimpleInjector -Version 3.8.0
<PackageReference Include="ServiceResolver.GenericHost.SimpleInjector" Version="3.8.0" />
<PackageVersion Include="ServiceResolver.GenericHost.SimpleInjector" Version="3.8.0" />
<PackageReference Include="ServiceResolver.GenericHost.SimpleInjector" />
paket add ServiceResolver.GenericHost.SimpleInjector --version 3.8.0
#r "nuget: ServiceResolver.GenericHost.SimpleInjector, 3.8.0"
#:package ServiceResolver.GenericHost.SimpleInjector@3.8.0
#addin nuget:?package=ServiceResolver.GenericHost.SimpleInjector&version=3.8.0
#tool nuget:?package=ServiceResolver.GenericHost.SimpleInjector&version=3.8.0
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+)
No extra package needed — UseServiceResolver replaces the app's IServiceProvider, and ASP.NET Core's own default IHttpContextFactory/IControllerActivator already give correct per-request scoping and controller activation against it.
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Host.UseServiceResolver(new SimpleInjectorOptions
{
OnRegistering = serviceRegister =>
{
serviceRegister.Register<IMyScopedService, MyScopedService>(LifetimeScope.Scoped);
},
AfterBuildingProvider = provider =>
{
provider.Verify();
}
});
var app = builder.Build();
app.UseAuthorization();
app.MapControllers();
await app.RunAsync();
Want controllers constructed (and disposed) by the native container instead of ASP.NET Core's own ActivatorUtilities-based activation — e.g. so Verify() above covers them too? Install ServiceResolver.GenericHost.AspNetCore and call serviceRegister.AddControllerActivation() from OnRegistering — its own readme covers this and the rest of that package's (optional) extension methods.
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 toUseServiceResolver.
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.
Related packages
ServiceResolver.GenericHostServiceResolver.Ioc.SimpleInjectorServiceResolver.GenericHost.AspNetCore(optional — native controller activation)
| Product | Versions 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. |
-
.NETStandard 2.1
- ServiceResolver.GenericHost (>= 3.8.0)
- ServiceResolver.Ioc.SimpleInjector (>= 2.11.0)
-
net10.0
- ServiceResolver.GenericHost (>= 3.8.0)
- ServiceResolver.Ioc.SimpleInjector (>= 2.11.0)
-
net6.0
- ServiceResolver.GenericHost (>= 3.8.0)
- ServiceResolver.Ioc.SimpleInjector (>= 2.11.0)
-
net8.0
- ServiceResolver.GenericHost (>= 3.8.0)
- ServiceResolver.Ioc.SimpleInjector (>= 2.11.0)
-
net9.0
- ServiceResolver.GenericHost (>= 3.8.0)
- ServiceResolver.Ioc.SimpleInjector (>= 2.11.0)
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.8.0 | 96 | 9/9/2026 |
| 3.7.0 | 113 | 8/24/2026 |
| 3.6.4 | 109 | 8/21/2026 |
| 3.6.3 | 106 | 8/20/2026 |
| 3.6.2 | 103 | 8/20/2026 |
| 3.6.1 | 2,223 | 12/1/2025 |
| 3.5.2 | 719 | 8/6/2025 |
| 3.5.1 | 160 | 8/3/2025 |
| 3.4.2 | 417 | 6/24/2025 |
| 3.4.1 | 1,598 | 3/4/2025 |
| 3.4.1-rc2 | 190 | 2/27/2025 |
| 3.4.1-rc1 | 181 | 2/27/2025 |
| 3.3.3 | 303 | 2/11/2025 |
| 3.3.2 | 434 | 11/25/2024 |
| 3.3.1 | 548 | 10/10/2024 |
| 3.2.1 | 277 | 9/10/2024 |
| 3.1.1 | 275 | 9/9/2024 |
| 2.2.1 | 1,039 | 4/5/2024 |
| 2.1.1 | 384 | 2/28/2024 |
| 1.1.1 | 242 | 2/8/2024 |