I've installed the following Nuget packages into my project:
Automapper
AutoMapper.Extensions.Microsoft.DependencyInjection
I have added the line to ConfigureServices
in Startup.cs
.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
// . . .
services.AddAutoMapper();
}
I'm still getting a red line under services.AddAutoMapper()
. It says:
The Call is ambiguous between the following methods or properties: ServiceCollectionExtensions.AddAutoMapper(IServiceCollection, params Assembly[]) and ServiceCollectionExtensions.AddAutoMapper(IServiceCollection, params Type[])
Why is this happening? All the .NET Core add automapper guides I've read show to do it this way.
I just ran into this problem and came to know that You need to include following Nuget package AutoMapper.Extensions.Microsoft.Dependencyinjection