13

Using Visual Studio 2019 I installed AutoMapper version 8.1.0 via NuGet. When I try to add the services.AddAutoMapper() call though in my Startup.cs file I get a compiler error that the method doesn't exist.

I've already tried to do a dotnet clean and dotnet restore from the NuGet console but that didn't help.

3
  • docs.automapper.org/en/latest/… Commented May 20, 2019 at 5:21
  • Thanks, @LucianBargaoanu. I had installed your base package and didn't realize your NuGet link was pointing at a different package. Also, the "here" link goes to a 404. Commented May 20, 2019 at 14:37
  • I see that, but I have no idea why. A PR is welcome :) Commented May 20, 2019 at 14:58

2 Answers 2

34

It is an old thread, however the solution for this problem is to install Automapper.Extensions.Microsoft.DependencyInjection package along with your automapper package. I hope it helps.

Sign up to request clarification or add additional context in comments.

Comments

2

In 2024, uninstall AutoMapper.Extensions.Microsoft.DependencyInjection package

Starting with version 13.0, AddAutoMapper is part of the core package and the DI package is discontinued

If you are using AutoMapper.Extensions.Microsoft.DependencyInjection then NuGet package uninstall AutoMapper.Extensions.Microsoft.DependencyInjection package.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.