S
S
Saharman2019-10-18 15:22:46
ASP.NET
Saharman, 2019-10-18 15:22:46

Why doesn't Automapper work in Asp.net Core 3.0?

I'm trying to connect Automapper to an asp.net core 3.0 project.
To do this, added the package AutoMapper.Extensions.Microsoft.DependencyInjection v7.0.0 (latest)
Add code:

public void ConfigureServices(IServiceCollection services)
        {
            services.AddAutoMapper();
            services.AddControllers();
            
        }

I am getting an error:
Неоднозначный вызов следующих методов или свойств: 'ServiceCollectionExtensions.AddAutoMapper(IServiceCollection, params Assembly[])" и "ServiceCollectionExtensions.AddAutoMapper(IServiceCollection, params Type[])"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AndreikaKanareika, 2020-02-15
@AndreikaKanareika

Use:
services.AddAutoMapper(typeof(MyProfile1), typeof(MyProfile2));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question