AutoMapper Missing type map configuration

AutoMapper.AutoMapperMappingException : Missing type map configuration or unsupported mapping


While trying out AutoMapper I stumbled on the following error:


AutoMapperMappingException_1.PNG

AutoMapperMappingException_2.PNG

I am trying to map simple objects but "Mapper.Map" gives error "AutoMapper.AutoMapperMappingException : Missing type map configuration or unsupported mapping".


Where have you specified the mapping code (CreateMap) ?


You will get this error when CreateMap is not used. Everything works fine if I use CreateMap.


The working and finished version of the code is in this article : https://howtodevelop.net/article/29/how-to-use-automapper-in-aspnet-core


using AutoMapper;
using WebApplication1.Models;
using WebApplication1.Models.ViewModels;
namespace WebApplication1
{
    public class PersonProfile : Profile
    {
        public PersonProfile()
        {
            //CreateMap<VMPerson, Person>();
            //CreateMap<Person, VMPerson>();
        }
    }
}

Check if you have the correct class name. As you can see below, you may have used the wrong class names.


public PersonProfile()
{
    CreateMap<VMPerson, Employee>();
    CreateMap<Employee, VMPerson>();
}

tag : AutoMapper Error