Automapper.Mapper.CreateMap cannot be resolved

I moved some of my objects that I use automapper for another project. And suddenly I get the error "I cannot resolve CreateMap in the automapper profile."

enter image description here

I have been looking for a solution for several hours, but I can not find anything. I reinstalled the napet machine, but this did not help

+5
source share
2 answers

Make sure you do not have objects called "Mapper" in the current or parent namespace.

Try using the full name for Mapper, for example:

AutoMapper.Mapper.CreateMap<Address, AddressDTO>(); 

If this does not help, try clearing the ReSharper cache (if you are using R #), and then restart visual studio.

+3
source

If you are using the latest version, you can create such a map as shown below:

 Mapper.Initialize(cfg => { cfg.CreateMap<Address, AddressDTO>(); //cfg.CreateMap<Customer, RegisterViewModel>(); }); 
0
source

All Articles