[Solved] 'IServiceCollection' does not contain a definitionfor 'AddAutoMapper'and no accessible extension method 'AddAutoMapper' accepting a first argument of type 'IServiceCollection' could be found(are you missing a using directive or an assembly reference?)


I’m getting the below error while Adding the Mapper service in ConfigureService() method in the asp.net core application


After adding the AutoMapper extensions for the ASP.NET Core dependency injection API NuGet package into the application Issue has been solved.

Install-Package AutoMapper.Extensions.Microsoft.DependencyInjection -Version 8.1.1

If you haven’t installed the package this is a mistake so, that the reason you are getting this error, while installing the package to your application make sure you are correctly installing it to your API or the respective application/project () by selecting the default project in package manager console window


until I added AutoMapper.Extensions.Microsoft.DependencyInjection NuGet package the same problem is popping up to me. After intslled the package, I was able to run the app. I hope you find them helpful.

Shivaraju M

Over 3+ years experience in IT industry, good knowledge in . Net-based Web applications, windows applications, web services, and SPAs. I have played multiple roles related to technical delivery in multiple domains while working on over 10+ technologies. I am currently focused on continuous improvement and agile project management.

Post a Comment

Previous Post Next Post