![]() |
VOOZH | about |
dotnet add package Autofac --version 9.2.0
NuGet\Install-Package Autofac -Version 9.2.0
<PackageReference Include="Autofac" Version="9.2.0" />
<PackageVersion Include="Autofac" Version="9.2.0" />Directory.Packages.props
<PackageReference Include="Autofac" />Project file
paket add Autofac --version 9.2.0
#r "nuget: Autofac, 9.2.0"
#:package Autofac@9.2.0
#addin nuget:?package=Autofac&version=9.2.0Install as a Cake Addin
#tool nuget:?package=Autofac&version=9.2.0Install as a Cake Tool
👁 Autofac character
👁 Autofac logo
Autofac is an IoC container for Microsoft .NET. It manages the dependencies between classes so that applications stay easy to change as they grow in size and complexity. This is achieved by treating regular .NET classes as components.
👁 Build status
👁 codecov
👁 NuGet
You can get Autofac by grabbing the latest NuGet package. There are several application integration and extended functionality packages to choose from. If you're feeling adventurous, continuous integration builds are on MyGet.
Release notes are available on GitHub.
Need help with Autofac? We have a documentation site as well as API documentation. We're ready to answer your questions on Stack Overflow or check out the discussion forum.
Our Getting Started tutorial walks you through integrating Autofac with a simple application and gives you some starting points for learning more.
Super-duper quick start:
Register components with a ContainerBuilder and then build the component container.
var builder = new ContainerBuilder();
builder.Register(c => new TaskController(c.Resolve<ITaskRepository>()));
builder.RegisterType<TaskController>();
builder.RegisterInstance(new TaskController());
builder.RegisterAssemblyTypes(controllerAssembly);
var container = builder.Build();
Resolve services from a lifetime scope - either the container or a nested scope:
var taskController = container.Resolve<TaskController>();
There is a growing number of application integration libraries that make using Autofac with your application a snap. Support for several popular frameworks is also available through the "Extras" packages.
Intrigued? Check out our Getting Started walkthrough!
Autofac is licensed under the MIT license, so you can comfortably use it in commercial applications (we still love contributions though).
File issues in the repo with the associated feature/code.
Refer to the Contributor Guide for setting up and building Autofac source.
You can also open this repository right now in VS Code.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on Autofac:
| Package | Downloads |
|---|---|
|
Autofac.Extensions.DependencyInjection
Autofac implementation of the interfaces in Microsoft.Extensions.DependencyInjection.Abstractions, the .NET Framework dependency injection abstraction. |
|
|
Autofac.WebApi2
Autofac integration for ASP.NET WebAPI. |
|
|
Autofac.Extras.DynamicProxy
Autofac extension for enabling AOP in conjunction with Castle. |
|
|
Autofac.Mvc5
ASP.NET MVC 5 integration for Autofac. |
|
|
Autofac.Extras.Moq
Autofac extension for automocking and creation of mock objects in Moq. |
Showing the top 20 popular GitHub repositories that depend on Autofac:
| Repository | Stars |
|---|---|
|
Jackett/Jackett
API Support for your favorite torrent trackers
|
|
|
abpframework/abp
Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
|
|
|
kgrzybek/modular-monolith-with-ddd
Full Modular Monolith application with Domain-Driven Design approach.
|
|
|
LuckyPennySoftware/MediatR
Simple, unambitious mediator implementation in .NET
|
|
|
JamesNK/Newtonsoft.Json
Json.NET is a popular high-performance JSON framework for .NET
|
|
|
felixse/FluentTerminal
A Terminal Emulator based on UWP and web technologies.
|
|
|
dotnet/yarp
A toolkit for developing high-performance HTTP reverse proxy applications.
|
|
|
Richasy/Bili.Uwp
适用于新系统UI的哔哩
|
|
|
BartoszCichecki/LenovoLegionToolkit
Lightweight Lenovo Vantage and Hotkeys replacement for Lenovo Legion laptops.
|
|
|
win-acme/win-acme
Automate SSL/TLS certificates on Windows with ease
|
|
|
ServiceStack/ServiceStack
Thoughtfully architected, obscenely fast, thoroughly enjoyable web services for all
|
|
|
stratumauth/app
📱 Two-Factor Authentication (2FA) client for Android + Wear OS
|
|
|
cyanfish/naps2
Scan documents to PDF and more, as simply as possible.
|
|
|
xamarin/xamarin-forms-samples
Sample apps built using the Xamarin.Forms framework
|
|
|
cq-panda/Vue.NetCore
(已支持sqlsugar).NetCore、.Net6、Vue2、Vue3、Vite、TypeScript、Element plus+uniapp前后端分离,全自动生成代码;支持移动端(ios/android/h5/微信小程序。http://www.volcore.xyz/
|
|
|
cake-build/cake
:cake: Cake (C# Make) is a cross platform build automation system.
|
|
|
fluentmigrator/fluentmigrator
Fluent migrations framework for .NET
|
|
|
ChangemakerStudios/Papercut-SMTP
Papercut SMTP -- The Simple Desktop Email Server
|
|
|
microsurging/surging
Surging is a micro-service engine that provides a lightweight, high-performance, modular RPC request pipeline. support Event-based Asynchronous Pattern and reactive programming.
|
|
|
bombomby/optick
C++ Profiler For Games
|
| Version | Downloads | Last Updated |
|---|---|---|
| 9.2.0 | 8,145 | 6/16/2026 |
| 9.1.0 | 4,902,397 | 3/12/2026 |
| 9.0.0 | 3,450,562 | 11/18/2025 |
| 8.4.0 | 9,509,071 | 8/4/2025 |
| 8.3.0 | 4,451,259 | 5/7/2025 |
| 8.2.1 | 6,383,413 | 4/3/2025 |
| 8.2.0 | 7,187,854 | 12/17/2024 |
| 8.1.1 | 9,631,618 | 10/9/2024 |
| 8.1.0 | 24,768,258 | 9/2/2024 |
| 8.0.0 | 32,977,579 | 1/16/2024 |
| 7.1.0 | 13,007,805 | 8/11/2023 |
| 7.0.1 | 6,938,616 | 4/18/2023 |
| 7.0.0 | 4,313,998 | 3/7/2023 |
| 6.5.0 | 20,987,223 | 11/16/2022 |
| 6.4.0 | 41,254,356 | 5/25/2022 |
| 6.3.0 | 28,587,358 | 10/8/2021 |
| 6.2.0 | 18,077,848 | 4/21/2021 |
| 6.1.0 | 12,255,455 | 12/4/2020 |
| 6.0.0 | 40,530,730 | 9/28/2020 |
| 5.2.0 | 26,381,701 | 5/11/2020 |
Release notes are at https://github.com/autofac/Autofac/releases