QuickServices.Hosting 1.0.2

dotnet add package QuickServices.Hosting --version 1.0.2
                    
NuGet\Install-Package QuickServices.Hosting -Version 1.0.2
                    
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="QuickServices.Hosting" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="QuickServices.Hosting" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="QuickServices.Hosting" />
                    
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 QuickServices.Hosting --version 1.0.2
                    
#r "nuget: QuickServices.Hosting, 1.0.2"
                    
#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 QuickServices.Hosting@1.0.2
                    
#: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=QuickServices.Hosting&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=QuickServices.Hosting&version=1.0.2
                    
Install as a Cake Tool

QuickServices

Attribute-based service registration for Microsoft.Extensions.DependencyInjection. Decorate your classes with attributes and let QuickServices handle the rest — no more manual AddTransient/AddScoped/AddSingleton calls.

Installation

QuickServices targets .NET 8, .NET 9, and .NET 10.

Package Description
QuickServices Core attribute-based DI registration
QuickServices.Hosting IHostedService registration support

Quick start

// Scan a specific assembly
builder.Services.AddQuickServices(typeof(Program).Assembly);

// Or auto-scan the calling assembly and all its referenced projects
builder.Services.AddQuickServices();

The parameterless overload automatically discovers all referenced assemblies that use QuickServices — no need to list them manually.

Attributes

Standard services

Register a class as its own service type:

[TransientService]
public class MyService { }

[ScopedService]
public class MyScopedService { }

[SingletonService]
public class MySingletonService { }

Interface registration

Use the generic variant to register a class as an implementation of an interface:

[TransientService<IMyService>]
public class MyService : IMyService { }

[ScopedService<IMyScopedService>]
public class MyScopedService : IMyScopedService { }

[SingletonService<IMySingletonService>]
public class MySingletonService : IMySingletonService { }

Multiple registrations

All attributes support AllowMultiple = true, so a single class can be registered under multiple interfaces:

[ScopedService<IReader>]
[ScopedService<IWriter>]
public class ReadWriteService : IReader, IWriter { }

Keyed services

Register services with a key for keyed DI (.NET 8+):

[KeyedTransientService<INotifier>("email")]
public class EmailNotifier : INotifier { }

[KeyedScopedService<INotifier>("sms")]
public class SmsNotifier : INotifier { }

[KeyedSingletonService<ICache>("redis")]
public class RedisCache : ICache { }

Non-generic variants are also available:

[KeyedTransientService("email")]
public class EmailNotifier { }

Hosted services

With the QuickServices.Hosting package, register hosted services separately:

using QuickServices.Hosting;

// Scan a specific assembly
builder.Services.AddQuickHostedServices(typeof(Program).Assembly);

// Or auto-scan all referenced projects
builder.Services.AddQuickHostedServices();
[HostedService]
public class MyBackgroundJob : BackgroundService
{
    protected override async Task ExecuteAsync(CancellationToken stoppingToken)
    {
        // ...
    }
}

The class must implement IHostedService, otherwise an InvalidOperationException is thrown at startup.

Registration order

By default, all services are registered with RegistrationOrder = 1. When the order matters — for example, when multiple implementations of the same interface are resolved as IEnumerable<T> — you can control it explicitly:

[ScopedService<IHandler>(registrationOrder: 1)]
public class FirstHandler : IHandler { }

[ScopedService<IHandler>(registrationOrder: 2)]
public class SecondHandler : IHandler { }

Services with a lower RegistrationOrder are registered first. This ordering is applied globally across all scanned assemblies.

Keyed services support it as well:

[KeyedScopedService<IHandler>("key", registrationOrder: 1)]
public class FirstHandler : IHandler { }

Attribute summary

Attribute Lifetime Keyed
[TransientService] / [TransientService<T>] Transient No
[ScopedService] / [ScopedService<T>] Scoped No
[SingletonService] / [SingletonService<T>] Singleton No
[KeyedTransientService(key)] / [KeyedTransientService<T>(key)] Transient Yes
[KeyedScopedService(key)] / [KeyedScopedService<T>(key)] Scoped Yes
[KeyedSingletonService(key)] / [KeyedSingletonService<T>(key)] Singleton Yes
[HostedService] Singleton No

License

See LICENSE for details.

Product Compatible and additional computed target framework versions.
.NET 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. 
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
1.0.2 154 4/15/2026
1.0.1 129 4/10/2026
1.0.0 130 4/8/2026