AutoMapper 17.0.0

AutoMapper

CI NuGet Documentation Status

What is AutoMapper?

AutoMapper is a simple little library built to solve a deceptively complex problem - getting rid of code that mapped one object to another. This type of code is rather dreary and boring to write, so why not invent a tool to do it for us?

This is the main repository for AutoMapper, but there's more:

How do I get started?

First, configure AutoMapper to know what types you want to map, in the startup of your application:

var configuration = new MapperConfiguration(cfg => 
{
    cfg.CreateMap<Foo, FooDto>();
    cfg.CreateMap<Bar, BarDto>();
}, loggerFactory);

// or more typically, using IServiceCollection with automatic service registration
services.AddAutoMapper(cfg => 
{
    cfg.CreateMap<Foo, FooDto>();
    cfg.CreateMap<Bar, BarDto>();
});
// AutoMapper will automatically register any implementations of:
// - IValueResolver<TSource, TDestination, TDestMember>
// - IMemberValueResolver<TSource, TDestination, TSourceMember, TDestMember>
// - ITypeConverter<TSource, TDestination>
// - IValueConverter<TSourceMember, TDestinationMember>
// - ICondition<TSource, TDestination, TDestMember>
// - IPreCondition<TSource, TDestination>
// - IMappingAction<TSource, TDestination>
// from the provided assemblies

// only during development, validate your mappings; remove it before release
#if DEBUG
configuration.AssertConfigurationIsValid();
#endif
// use DI (http://docs.automapper.io/en/latest/Dependency-injection.html) or create the mapper yourself
var mapper = configuration.CreateMapper();

Then in your application code, execute the mappings:

var fooDto = mapper.Map<FooDto>(foo);
var barDto = mapper.Map<BarDto>(bar);

Check out the getting started guide. When you're done there, the wiki goes in to the nitty-gritty details. If you have questions, you can post them to Stack Overflow.

Where can I get it?

First, install NuGet. Then, install AutoMapper from the package manager console:

PM> Install-Package AutoMapper

Or from the .NET CLI as:

dotnet add package AutoMapper

Do you have an issue?

You might want to know exactly what your mapping does at runtime.

If you're still running into problems, file an issue above.

If you are a paying customer, you can contact support via your account.

How do I set the license key?

The simplest way is to set an environment variable (AutoMapper 16.2.0 and later), with no code change needed:

  • AUTOMAPPER_LICENSE_KEY: the AutoMapper license key.
  • LUCKYPENNY_LICENSE_KEY: a key shared across Lucky Penny products. It must be for a license that includes AutoMapper.

Or you can set the license key in code when registering AutoMapper, which takes precedence over the environment variables:

services.AddAutoMapper(cfg => 
{
    cfg.LicenseKey = "<license key here>";
})

See License configuration for all the options.

You can register for your license key at AutoMapper.io

Showing the top 20 packages that depend on AutoMapper.

Packages Downloads
IdentityServer4.EntityFramework.Storage
EntityFramework persistence layer for IdentityServer4
170
IdentityServer4.EntityFramework.Storage
EntityFramework persistence layer for IdentityServer4
143
UmbracoCms.Core
Contains the core assemblies needed to run Umbraco Cms. This package only contains assemblies and can be used for package development. Use the UmbracoCms-package to setup Umbraco in Visual Studio as an ASP.NET project.
46
UmbracoCms.Core
Contains the core assemblies needed to run Umbraco Cms. This package only contains assemblies and can be used for package development. Use the UmbracoCms-package to setup Umbraco in Visual Studio as an ASP.NET project.
43
UmbracoCms.Core
Contains the core assemblies needed to run Umbraco Cms. This package only contains assemblies and can be used for package development. Use the UmbracoCms-package to setup Umbraco in Visual Studio as an ASP.NET project.
42
UmbracoCms.Core
Contains the core assemblies needed to run Umbraco Cms. This package only contains assemblies and can be used for package development. Use the UmbracoCms-package to setup Umbraco in Visual Studio as an ASP.NET project.
41
UmbracoCms.Core
Contains the core assemblies needed to run Umbraco Cms. This package only contains assemblies and can be used for package development. Use the UmbracoCms-package to setup Umbraco in Visual Studio as an ASP.NET project.
40
UmbracoCms.Core
Contains the core assemblies needed to run Umbraco Cms. This package only contains assemblies and can be used for package development. Use the UmbracoCms-package to setup Umbraco in Visual Studio as an ASP.NET project.
39
UmbracoCms.Core
Contains the core assemblies needed to run Umbraco Cms. This package only contains assemblies and can be used for package development. Use the UmbracoCms-package to setup Umbraco in Visual Studio as an ASP.NET project.
38
UmbracoCms.Core
Contains the core assemblies needed to run Umbraco Cms. This package only contains assemblies and can be used for package development. Use the UmbracoCms-package to setup Umbraco in Visual Studio as an ASP.NET project.
37

Version Downloads Last updated
17.0.0 1 11/18/2026
16.3.0 1 11/10/2026
16.2.0 19 07/06/2026
16.1.1 20 03/21/2026
16.1.0 17 03/21/2026
16.0.0 26 12/20/2025
16.0.0-beta-1 17 11/28/2025
15.1.4 1 11/11/2026
15.1.3 14 03/21/2026
15.1.0 25 11/28/2025
15.0.1 16 07/20/2025
15.0.0 25 07/07/2025
14.0.0 23 03/15/2025
13.0.1 19 06/19/2024
12.0.1 26 01/07/2024
12.0.0 26 12/18/2023
11.0.1 25 01/07/2024
11.0.0 32 06/20/2022
10.1.1 25 01/07/2024
10.0.0 178 02/16/2021
9.0.0 29 03/22/2021
8.1.1 27 01/07/2024
8.1.0 17 12/27/2023
8.0.0 21 01/07/2024
7.0.1 27 12/18/2023
7.0.0-alpha-0001 21 01/08/2024
6.2.2 19 01/07/2024
6.2.1 19 01/07/2024
6.2.0 23 01/07/2024
6.1.1 24 12/25/2023
6.1.0 19 01/04/2024
6.0.2 16 01/07/2024
5.2.0 25 01/03/2024
5.1.1 23 01/07/2024
5.0.2 23 01/07/2024
5.0.0-beta-1 19 01/09/2024
4.2.1 20 01/07/2024
4.2.0 22 12/19/2023
4.1.1 23 12/14/2023
4.0.4 22 01/07/2024
4.0.0-alpha1 21 01/08/2024
3.3.1 28 01/07/2024
3.3.0 22 01/07/2024
3.2.1 30 01/07/2024
3.1.1 15 01/07/2024
3.1.0 20 01/07/2024
3.0.0 17 01/07/2024
2.2.1 21 01/07/2024
2.2.0 24 12/11/2023
2.1.267 24 01/07/2024
2.1.266 18 01/07/2024
2.1.265 18 12/19/2023
2.1.262 24 01/07/2024
2.1.1 19 01/07/2024
2.0.0 18 01/07/2024
1.1.2 23 12/29/2023
1.1.0.118 17 12/22/2023