DryIoc 6.0.0
Prefix ReservedRequires NuGet 3.3.0 or higher.
dotnet add package DryIoc --version 6.0.0
NuGet\Install-Package DryIoc -Version 6.0.0
<PackageReference Include="DryIoc" Version="6.0.0" />
<PackageVersion Include="DryIoc" Version="6.0.0" />
<PackageReference Include="DryIoc" />
paket add DryIoc --version 6.0.0
#r "nuget: DryIoc, 6.0.0"
#:package DryIoc@6.0.0
#addin nuget:?package=DryIoc&version=6.0.0
#tool nuget:?package=DryIoc&version=6.0.0
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
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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 was computed. 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. |
| .NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
| 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. |
-
.NETFramework 4.7.2
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net10.0
- No dependencies.
-
net11.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (22)
Showing the top 5 NuGet packages that depend on DryIoc:
| Package | Downloads |
|---|---|
|
DryIoc.MefAttributedModel
DryIoc.MefAttributedModel is DryIoc extension to support Microsoft Managed Extensibility Framework for DryIoc container |
|
|
DryIoc.CommonServiceLocator
Implementation of CommonServiceLocator for DryIoc container, see rationale at https://github.com/unitycontainer/commonservicelocator |
|
|
DryIoc.WebApi
DryIoc extension for ASP.NET WebAPI |
|
|
DryIoc.Web
DryIoc extension for ASP.NET providing Web Request Reuse |
|
|
DryIoc.Owin
DryIoc extension for OWIN |
GitHub repositories (4)
Showing the top 4 popular GitHub repositories that depend on DryIoc:
| Repository | Stars |
|---|---|
|
CXWorld/CapFrameX
Frametime capture and analysis tool
|
|
|
seesharper/LightInject
An ultra lightweight IoC container
|
|
|
MicroSugarDeveloperOrg/Webviews.Avalonia
|
|
|
fluffynuts/PeanutButter
Tasty, versatile, nutritious; goes with many things in .net.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 6.0.0 | 57 | 11/21/2026 |
| 6.0.0-preview-08 | 1,580 | 10/27/2024 |
| 6.0.0-preview-07 | 1,170 | 3/17/2024 |
| 5.4.3 | 290,956 | 11/12/2023 |
| 5.4.2 | 7,564 | 10/17/2023 |
| 5.4.1 | 12,379 | 6/10/2023 |
| 5.4.0 | 5,887 | 5/1/2023 |
| 5.3.4 | 5,033 | 3/13/2023 |
| 5.3.3 | 3,213 | 2/16/2023 |
| 5.3.2 | 2,461 | 2/9/2023 |
| 5.3.1 | 5,831 | 11/28/2022 |
| 5.3.0 | 52,502 | 11/10/2022 |
| 5.2.2 | 16,884 | 8/23/2022 |
| 5.2.1 | 17,981 | 8/9/2022 |
| 5.2.0 | 4,256 | 8/3/2022 |
| 5.1.0 | 96,475 | 5/20/2022 |
| 5.0.2 | 26,026 | 5/10/2022 |
| 5.0.1 | 3,447 | 4/22/2022 |
| 5.0.0 | 5,309 | 4/13/2022 |
| 4.8.8 | 25,242 | 3/16/2022 |
## v6.0.0 Major feature release
### Bird view
- 10, 11 is now supported, interim .net versions dropped and net45 -> net472, netstandard2.0 -> netstandard2.1
- Decrease memory footprint without speed regression
- Remove Obsolete API (small things in more customizable parts of Container)
- Compile-time Dependency Injection (T4-based, AOT-friendly; see `readme.md` in the DryIoc.dll NuGet package)
- #492 Remove obsolete WithAutoFallbackResolution
### Features
- #695 Improve DryIoc.dll NuGet package CompileTime DI install/update experience
- #679 Add DryIoc own all-encompassing RegisterAttribute
- #676 Add the Settings.ThrowOnRegisteringDisposableTransient on the registration level to override the global setting
- #660 Populate on IRegistrator
- #638 Add the global test option to run all tests with WithoutUseInterpretation option
- #636 [question/feature request] keyed services in delegate resolution
- #632 MS DI AddKeyed... variant registration fails
- #618 Multiple same service key support mostly for DryIoc.MS.DI though it is already supported in DryIoc.MefAttributedModel
- #612 For the conditional singleton or the singleton registered with AnyKey - should we create a new singleton per condition or the resolution key?
- #512 Optimize injection of IResolverContext
- #504 Probably add the IDictionary<TServiceKey, TService> wrapper
- #503 [CompTimeDI] Replace partial methods with more flexible interface ICompileTimeContainer
- #495 [CompTimeDI] Automatically generate Resolution calls for the missing registrations to avoid manual RegisterPlaceholder
- #485 Add Rules to IResolverContext interface
- #480 Change Request.Container property to field and change its type from IContainer to Container
- #223 IAsyncDisposable is not being called after container.Dispose
- #212 Improve source package with T4 install experience
### Fixes
- #708 Missed parent parameter in IContainer.With overload
- #694 Singleton service resolved by scoped container, not root container
- #692 Resolve failed on Android(Avalonia)
- #690 DryIoc is not working together with Blazor InputFile component
- #685 Creating scopes via funcs is not thread-safe and fails sporadically with NullRef exception
- #672 Wrong decorator parameter with custom args
- #653 KeyValuePair exposes internal DryIoc structures
- #651 Resolving func-wrapper when having circular-dependency throws RecursiveDependencyDetected
- #648 [BUG] Resolve<> crashes with the misleading, casting-related Exception when class is also registered using RegisterInitializer
- #646 Resolve enforces passed arguments to be used (and fails because of it)
- #643 WithConcreteTypeDynamicRegistrations results in unintended instantiation
- #642 System.NullReferenceException: Object reference not set to an instance of an object
- #631 Conditional registrations
- #625 FactoryType is not forwarded in the RegisterMapping<TService, TRegisteredService> method
- #624 Consistent behavior of a faulty singleton
- #623 Scoped service decorator
- #610 ConstructorWithResolvableArguments conflicts with dynamic registrations
- #580 Scope is lost in IResolver inside scope because of singleton
- #535 Property injection is not working correctly when appending a new implementation for multiple registrations of the same interface and injecting an enumerable of the interface.
- #552 Compatibility with Android/iOS AOT compilation
- #532 [Xamarin.iOS] DryIocTypeResolver.Resolve (System.Type type) SIGABRT: Operation is not supported on this platform.