title: How to upgrade Automapper 4.2.1 to 6.1.1 in solution. What I'm missing?
body: <p>I'm update my automapper 4.2.1 from nuget and it was install automapper 6.1.1 version. In old version all mapping works properly but when I update my automapper library mapping didn't work it says that Missing type map configuration or unsupported mapping. Mapping types  when use <code>Mapper.Map&lt;Class1,Class2&gt;(result)</code>. I'm using profile to configure in <code>global.asax</code>. My project is C# MVC and here is my codes;</p>
  
  <p>In Global.asax</p>
  
  <pre><code> public class MvcApplication : HttpApplication
      {
          protected void Application_Start()
          {
             AutoMapperConfigurations.Configure();
          }
      }
  </code></pre>
  
  <p>My Mapper configuration</p>
  
  <pre><code>public class AutoMapperConfigurations
      {
          public static void Configure()
          {
  
              Mapper.Initialize(cfg =&gt;
              {
                  cfg.AddProfile&lt;ModeltoDTOMappingsProfile&gt;();
                  cfg.AddProfile&lt;DTOtoDTOModelMappingsProfile&gt;();
                  cfg.AddProfile&lt;DTOtoViewModelMappingsProfile&gt;();
                  //cfg.ForAllMaps((tm, me) =&gt; me.ForAllMembers(option =&gt; option.Condition((source, destination, sourceMember) =&gt; sourceMember != null)));
              });
  
  
              Mapper.AssertConfigurationIsValid();
     }
  </code></pre>
  
  <p>Here is my one profile example code</p>
  
  <pre><code>public class DTOtoViewModelMappingsProfile: Profile
      {
  
          public DTOtoViewModelMappingsProfile()
          {
  
              Mapper.Initialize(cfg =&gt;
              {
                  // Also I tried these one but It didn't work
  
                  //cfg.CreateMissingTypeMaps = true;
                  //cfg.AllowNullCollections = true;
                  //cfg.AllowNullDestinationValues = false;
                  //cfg.ForAllMaps((tm, me) =&gt; me.ForAllMembers(option =&gt; option.Condition((source, destination, sourceMember) =&gt; sourceMember != null)));
  
      #region Category
  
                  cfg.CreateMap&lt;TreeCategoryViewModel, TreeCategoryDtos&gt;()
                      .ForMember(dest =&gt; dest.T_C_ID, opt =&gt; opt.MapFrom(src =&gt; src.CId))
                      .ForMember(dest =&gt; dest.T_C_DESC, opt =&gt; opt.MapFrom(src =&gt; src.CDesc))
                      .ForMember(dest =&gt; dest.T_C_INUSE, opt =&gt; opt.MapFrom(src =&gt; src.CInuse))
                      .ForMember(dest =&gt; dest.T_IS_TECH, opt =&gt; opt.MapFrom(src =&gt; src.IsTech))
                      .ForMember(dest =&gt; dest.T_IS_BRANCH, opt =&gt; opt.MapFrom(src =&gt; src.IsBranch))
                      .ForMember(dest =&gt; dest.T_IS_MARKETING, opt =&gt; opt.MapFrom(src =&gt; src.IsMarketing))
                      .ForMember(dest =&gt; dest.T_IS_SUPPORT, opt =&gt; opt.MapFrom(src =&gt; src.IsSupport))
                      .ForMember(dest =&gt; dest.T_C_LEVEL, opt =&gt; opt.MapFrom(src =&gt; src.CLevel))
                      .ForMember(dest =&gt; dest.T_C_ORDER, opt =&gt; opt.MapFrom(src =&gt; src.COrder))
                      .ForMember(dest =&gt; dest.T_C_PARENT, opt =&gt; opt.MapFrom(src =&gt; src.CParent))
                      .ForMember(dest =&gt; dest.TREE_CATEGORY1, opt =&gt; opt.ResolveUsing(src =&gt; src.TreeCategoryDtos1))
                      .ForMember(dest =&gt; dest.TREE_CATEGORY2, opt =&gt; opt.ResolveUsing(src =&gt; src.TreeCategoryDtos2))
                      ;
  
                  cfg.CreateMap&lt;TreeCategoryDtos, TreeCategoryViewModel&gt;()
                      .ForMember(dest =&gt; dest.CId, opt =&gt; opt.MapFrom(src =&gt; src.T_C_ID))
                      .ForMember(dest =&gt; dest.CDesc, opt =&gt; opt.MapFrom(src =&gt; src.T_C_DESC))
                      .ForMember(dest =&gt; dest.CInuse, opt =&gt; opt.MapFrom(src =&gt; src.T_C_INUSE))
                      .ForMember(dest =&gt; dest.IsTech, opt =&gt; opt.MapFrom(src =&gt; src.T_IS_TECH))
                      .ForMember(dest =&gt; dest.IsBranch, opt =&gt; opt.MapFrom(src =&gt; src.T_IS_BRANCH))
                      .ForMember(dest =&gt; dest.IsMarketing, opt =&gt; opt.MapFrom(src =&gt; src.T_IS_MARKETING))
                      .ForMember(dest =&gt; dest.IsSupport, opt =&gt; opt.MapFrom(src =&gt; src.T_IS_SUPPORT))
                      .ForMember(dest =&gt; dest.CLevel, opt =&gt; opt.MapFrom(src =&gt; src.T_C_LEVEL))
                      .ForMember(dest =&gt; dest.COrder, opt =&gt; opt.MapFrom(src =&gt; src.T_C_ORDER))
                      .ForMember(dest =&gt; dest.CParent, opt =&gt; opt.MapFrom(src =&gt; src.T_C_PARENT))
                      .ForMember(dest =&gt; dest.TreeCategoryDtos1, opt =&gt; opt.ResolveUsing(src =&gt; src.TREE_CATEGORY1))
                      .ForMember(dest =&gt; dest.TreeCategoryDtos2, opt =&gt; opt.ResolveUsing(src =&gt; src.TREE_CATEGORY2))
                      ;
  
                  #endregion
  
              });
  
              Mapper.AssertConfigurationIsValid();
          }
  </code></pre>
  
  <p>In Controller</p>
  
  <pre><code>var result = Mapper.Map&lt;TreeCategoryViewModel,TreeCategoryDtos&gt;(treeCategories);
  </code></pre>
  
  <p>It was exception in this line. Why I'm getting this error?.(Missing type map configuration or unsupported mapping. Mapping types: TreeCategoryViewModel -> TreeCategoryDtos Project.Models.ViewModel.TreeCategoryViewModel -> Project.BusinessLayer.CategoriesBL.Dtos.TreeCategoryDtos )</p>
  
  <hr>
  
  <p>Now the error message has changed. This is what I'm getting now " <strong>Mapper not initialized. Call Initialize with appropriate configuration. If you are trying to use mapper instances through a container or otherwise, make sure you do not have any calls to the static Mapper.Map methods, and if you're using ProjectTo or UseAsDataSource extension methods, make sure you pass in the appropriate IConfigurationProvider instance.</strong>"</p>
  
  <p>But the error comes from this class.In my model mapping.</p>
  
  <pre><code>public class ModeltoDTOMappingsProfile : Profile
      {
          public ModeltoDTOMappingsProfile()
          {
                   CreateMap&lt;TREE_CATEGORY, TreeCategoryDtos&gt;();
                   CreateMap&lt;TreeCategoryDtos, TREE_CATEGORY&gt;()
                      .ForMember(dest =&gt; dest.G_MARK_FOR_DELETE, opt =&gt; opt.Ignore())
                      .ForMember(dest =&gt; dest.L_INSERTDATE, opt =&gt; opt.Ignore())
                      .ForMember(dest =&gt; dest.L_INSERTUSER, opt =&gt; opt.Ignore())
                      .ForMember(dest =&gt; dest.L_UPDATEDATE, opt =&gt; opt.Ignore())
                      .ForMember(dest =&gt; dest.L_UPDATEUSER, opt =&gt; opt.Ignore());
  
          }
      }
  </code></pre>
  
  <p>I'm using AutomapperConfigurations to call my profile in global.asax. You can see these code above</p>