Blog Post

AutoMapper - CreateMap does not work after upgrade

Tuesday, July 12, 2016 12:32 PM

Updating AutoMapper nugget package

One of packages I am using for my site is Auto mapper. A nifty little package that does save so much time to work with, if you use it correctly.

I do not understand all applications as yet, but I did grasp the basic.


While working with it I thought, is there a new version and after how much different it is.


Turns out, there was new version released and currently is: 

<package id="AutoMapper" version="4.2.1" targetFramework="net451" />

to new one 

<package id="AutoMapper" version="5.0.2" targetFramework="net451" />


The mapping syntax has changed, but the GitHub project repository did help.

So the syntax has changed for creating maps between classes  

 Mapper.CreateMap<BusinessUser, ClientUser>();


 Mapper.Initialize(cfg => cfg.CreateMap<BusinessUser, ClientUser>());

To access wiki for auto mapper: