AutoMapper.Extensions.Microsoft.DependencyInjection 12.0.0

The ID prefix of this package has been reserved for one of the owners of this package by Prefix Reserved
.NET Standard 2.1
dotnet add package AutoMapper.Extensions.Microsoft.DependencyInjection --version 12.0.0
NuGet\Install-Package AutoMapper.Extensions.Microsoft.DependencyInjection -Version 12.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="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AutoMapper.Extensions.Microsoft.DependencyInjection --version 12.0.0
#r "nuget: AutoMapper.Extensions.Microsoft.DependencyInjection, 12.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install AutoMapper.Extensions.Microsoft.DependencyInjection as a Cake Addin
#addin nuget:?package=AutoMapper.Extensions.Microsoft.DependencyInjection&version=12.0.0

// Install AutoMapper.Extensions.Microsoft.DependencyInjection as a Cake Tool
#tool nuget:?package=AutoMapper.Extensions.Microsoft.DependencyInjection&version=12.0.0

AutoMapper extensions for Microsoft.Extensions.DependencyInjection

CI NuGet MyGet (dev)

Scans assemblies and:

  1. adds profiles to mapping configuration
  2. adds value resolvers, member value resolvers, type converters to the container.

To use, with an IServiceCollection instance and one or more assemblies:

services.AddAutoMapper(assembly1, assembly2 /*, ...*/);

or marker types:

services.AddAutoMapper(type1, type2 /*, ...*/);

This registers AutoMapper:

  • As a singleton for the MapperConfiguration
  • As a transient instance for IMapper
  • ITypeConverter instances as transient
  • IValueConverter instances as transient
  • IValueResolver instances as transient
  • IMemberValueResolver instances as transient
  • IMappingAction instances as transient

Mapping configuration is static as it is the root object that can create an IMapper.

Mapper instances are registered as transient. You can configure this with the serviceLifetime parameter. Be careful changing this, as Mapper takes a dependency on a factory method to instantiate the other extensions.

Mapper.Map usage

To map at runtime, add a dependency on IMapper:

public class EmployeesController {
	private readonly IMapper _mapper;

	public EmployeesController(IMapper mapper)
		=> _mapper = mapper;

	// use _mapper.Map to map

ProjectTo usage

Starting with 8.0 you can use IMapper.ProjectTo. The old ProjectTo is an extension method and does not have dependency injection available. Pass an IConfigurationProvider instance directly:

var orders = await dbContext.Orders

Or you can use an IMapper instance:

var orders = await dbContext.Orders
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.1
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (774)

Showing the top 5 NuGet packages that depend on AutoMapper.Extensions.Microsoft.DependencyInjection:

Package Downloads

Package Description


Package Description


Elsa is a set of workflow libraries and tools that enable lean and mean workflowing capabilities in any .NET Core application. This package contains the core of Elsa. Tip: reference the `Elsa` package instead of this one.


Plugins available for the Core framework


Experiene API functionality

GitHub repositories (172)

Showing the top 5 popular GitHub repositories that depend on AutoMapper.Extensions.Microsoft.DependencyInjection:

Repository Stars
🛠「Watt Toolkit」是一个开源跨平台的多功能 Steam 工具箱。
The core infrastructure backend (API, database, Docker, etc).
Clean Architecture Solution Template for .NET 7
Sample ASP.NET Core 6.0 reference application, powered by Microsoft, demonstrating a layered application architecture with monolithic deployment model. Download the eBook PDF from docs folder.
ASP.NET Core eCommerce software. nopCommerce is a free and open-source shopping cart.
Version Downloads Last updated
12.0.0 4,724,833 9/30/2022
11.0.0 19,711,787 1/5/2022
8.1.1 34,399,997 2/5/2021
8.1.0 10,559,160 10/14/2020
8.0.1 9,098,002 7/16/2020
8.0.0 621,898 7/9/2020
7.0.0 29,792,558 8/12/2019
6.1.1 4,057,340 6/4/2019
6.1.0 2,884,087 4/29/2019
6.0.0 9,139,310 11/18/2018
5.0.1 5,091,732 7/20/2018
4.0.1 3,367,786 6/18/2018
3.2.0 3,317,277 11/16/2017
3.1.0 226,068 10/26/2017
3.0.1 446,685 8/19/2017
2.0.1 883,993 3/30/2017
2.0.0 28,290 3/17/2017
1.2.0 167,403 12/29/2016
1.1.2 84,861 9/2/2016
1.1.0 64,889 8/11/2016
1.0.1-alpha 10,519 7/20/2016
1.0.0-alpha 1,089 7/20/2016