yocto.Wpf 3.0.0

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

<img src="https://raw.githubusercontent.com/MILL5/yocto/main/yocto3/docs/assets/yocto.png" alt="yocto logo" width="96" align="right" />

yocto — the tiny IoC container for .NET 10

NuGet NuGet downloads CI .NET 10 License: Apache 2.0

yocto is a free, open-source inversion-of-control (IoC) and dependency injection container for .NET 10. It is a drop-in IServiceProvider for ASP.NET Core and Microsoft.Extensions.DependencyInjection: it passes all 143 tests in Microsoft's DI specification suite. On top of that it adds child containers, per-thread and pooled lifetimes, modules, and build-time validation, in about 1,200 lines of C# (excluding comments).

📖 Documentation: https://mill5.github.io/yocto/

Install

dotnet add package yocto
dotnet add package yocto.Wpf   # optional: XAML markup extension

Quick start

using Yocto;

using var container = new Container();

container.RegisterSingleton<IClock, SystemClock>();
container.Register<IGreeter, Greeter>();                 // new instance per resolve (default)
container.Register<IGreeter, LoudGreeter>("loud");       // keyed
container.Register(typeof(IRepository<>), typeof(Repository<>)).AsScoped();  // open generic
container.Validate();                                    // fail fast on missing, circular, or captive dependencies

var greeter = container.Resolve<IGreeter>();             // Greeter(IClock clock) is constructor-injected

using var scope = container.CreateChildContainer();     // scoped services: one per child container
var orders = scope.Resolve<IRepository<Order>>();

ASP.NET Core

var builder = WebApplication.CreateBuilder(args);
builder.Host.UseServiceProviderFactory(new YoctoServiceProviderFactory(validateOnBuild: true));
builder.Host.ConfigureContainer<IContainer>(c => c.RegisterPooled<IEncoder, Encoder>(poolSize: 8));

Features

Feature API
Constructor injection (greediest satisfiable constructor) Register<TService, TImpl>()
Factories and existing instances Register<T>(c => …), RegisterInstance(obj)
Lifetimes AsMultiple() (default), AsSingleton(eagerLoad), AsScoped(), AsPerThread(), AsPooled(size)
Custom lifetimes Lifetimes.Register(name, ILifetimeFactory), WithLifetime(name)
Keyed services Register<T, V>(key), Resolve<T>(key), [FromKeyedServices], [ServiceKey]
Open generics Register(typeof(IRepo<>), typeof(Repo<>))
Multiple implementations RegisterEnumerable<T, V>(), ResolveAll<T>(), inject IEnumerable<T>
Child containers and scopes CreateChildContainer(), IServiceScopeFactory
Disposal Dispose() / DisposeAsync(), reverse creation order, transients tracked weakly
Validation Validate(), ContainerBuilder { ValidateOnBuild = true }
Modules IModule, RegisterModule<T>(), RegisterAssembly(assembly)
Ambient container Application.Current, Application.Push() / Pop()
ASP.NET Core / Generic Host YoctoServiceProviderFactory, BuildYoctoServiceProvider(), Populate(services)
WPF / XAML {yocto:Resolve {x:Type vm:MainViewModel}} (yocto.Wpf)
Native AOT and trimming IsAotCompatible, [DynamicallyAccessedMembers] throughout

FAQ

What is yocto? A tiny, open-source IoC/DI container for .NET 10 from MILL5. It is named after the SI prefix for 10⁻²⁴.

Can it replace the ASP.NET Core container? Yes. Use YoctoServiceProviderFactory. yocto passes Microsoft.Extensions.DependencyInjection.Specification.Tests 10.0, including keyed services, open generics, scopes, and disposal order.

How does it compare to Autofac or the built-in container? The built-in container is enough for many apps. Choose yocto when you also want child containers that override registrations, pooled or per-thread lifetimes, modules, or a container small enough to audit. Autofac offers more, such as decorators and interception, at a much larger size.

Does it support Native AOT? Yes. The library builds with IsAotCompatible and trimming annotations. The two exceptions: RegisterAssembly uses reflection, and open generics over value types need runtime code generation.

Which .NET versions? yocto 3 targets .NET 10 (LTS). yocto 1.x/2.x for .NET Framework, .NET Standard, and Xamarin are no longer maintained. See the migration guide.

More answers: https://mill5.github.io/yocto/faq/

Building from source

cd yocto3
dotnet build -c Release
dotnet test                       # yocto tests + Microsoft's DI specification suite
dotnet run --project samples/Yocto.Sample

Part of the MILL5 open-source family

Pineapple · FastSearch · M5.BloomFilter · Polygon.Net · Cut & Move · MacEdgeLight

Contributing

Issues and pull requests are welcome at https://github.com/MILL5/yocto. Please include tests; dotnet test must pass, including the specification suite.

License

This project is licensed under the Apache License 2.0. © MILL5, LLC.

Credits

Created by Richard Crane, Microsoft MVP and founder of MILL5.


Powered by MILL5 Explore Richard Crane on Microsoft MVP Listen to the Inventing Fire with AI podcast for insights on technology and innovation. For support, contact: rich@mill5.com

Product Compatible and additional computed target framework versions.
.NET net10.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0-windows7.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.0.0 67 11/2/2026