Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

AutoMapper .net 6.0 not in service

I downloaded automapper to a separate class library. I want to use this automapper in web api. I want to add automapper to services in program.cs, but it gives the following error.

Severity Code Description Project File Line Hide Status Error CS1061
‘IServiceCollection’ does not contain a definition of ‘AddAutoMapper’
and no accessible extension method ‘AddAutoMapper’ was found that
accepts a first argument of type ‘IServiceCollection’ (could be
missing a using directive or assembly reference?) WebApi
C:\Users\batu_\ Desktop\TaskProject\Backend\WebApi\Program.cs 8
Enabled

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I downloaded automapper from nuget to map class library

Can’t find AddAutoMapper in program.cs

builder.Services.AddAutoMapper(typeof(MappingProfile));

>Solution :

You need to add a reference to: AutoMapper.Extensions.Microsoft.DependencyInjection

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading