Install
dotnet add package DryIoc --version 6.0.0
| Product | Versions |
|---|---|
| .NET | |
| .NET Standard | |
| Other |
README
Hello Sailor,
Compile-time Dependency Injection (optional)
Compile-time DI gives faster startup, smaller footprint and AOT/trimming compatibility. Skip this section if you only need runtime DI β everything works without it.
On first dotnet build the package scaffolds your project:
| File | When copied |
|---|---|
CompileTimeDI\Container.Generated.tt |
every build (refreshed from package) |
CompileTimeDI\CompileTimeExampleServices.cs |
every build (refreshed from package) |
CompileTimeDI\CompileTimeRegistrations.ttinclude |
first install only β safe to customize |
CompileTimeDI\Container.Generated.cs |
first install only β regenerated by T4 on next build |
.config\dotnet-tools.json |
first install only β dotnet-t4 tool |
Usage
- Edit
CompileTimeDI\CompileTimeRegistrations.ttincludeβ add your services toGetContainerWithRegistrations()and set resolution roots. - Build in Debug mode. The second build regenerates
Container.Generated.csvia T4. - Check
Container.Generated.csfor the generated container and any warnings. - Use the compile-time container (runtime registrations on the same container are the fallback):
var container = new Container(rules => rules
.WithCompileTimeContainer(CompileTimeContainer.Instance));
Updating the package
Container.Generated.tt and CompileTimeExampleServices.cs are always refreshed.
CompileTimeRegistrations.ttinclude, Container.Generated.cs, and .config\dotnet-tools.json are never overwritten.
Opting out
Add <SkipCompTimeGen>true</SkipCompTimeGen> to your project file to disable T4 regeneration.
T4 editing tools
- VS Code: T4 Support
- Visual Studio: ForTea (ReSharper)
- Rider: native T4 support
Roadmap
Changes from Previous Version
v6.0.0-preview-08v6.0.0
Added Frameworks
.NETFramework4.7.2net8.0net10.0net11.0
Removed Frameworks
.NETFramework4.5.NETStandard2.0
Removed Dependencies
System.Reflection.Emit.Lightweight(.NETStandard2.0)
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
Compatibility metadata lists 5 target frameworks; confirm the exact target used by your application.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.