Automapper Profiles not being loaded in Startup?

Another solution for fixing the issue when we have mapping profiles in different projects in a solution is:

services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());

I figure it out. Since my mappings are in a different project, I did two things

  1. From my API project (where Startup.cs is located, added a reference to my xxxMapprings project)
  2. in ConfigureServices I used the overload AddAutoMapper that gets an Assembly:

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMvc();
    
        //register automapper
        services.AddAutoMapper(Assembly.GetAssembly(typeof(StatusMappingProfile))); //If you have other mapping profiles defined, that profiles will be loaded too.