title: Asp.Net Core AddAutoMapper Dynamic from Multi Projects
body: <p>I want to register AutoMapper form different project each project have it's public function to register his functions
  like this</p>
  <pre><code>public static class Binder
  {
      public static IServiceCollection UseInjection(this IServiceCollection services)
      {
         services.AddAutoMapper(typeof(MappingProfile));
      }
  }
  </code></pre>
  <p>if i do it on each layer it's not working .
  i need to write everything ones
  like this : (work)</p>
  <pre><code>  services.AddAutoMapper(
              typeof(Project1.Mapping.MappingProfile),
              typeof(Project2.Mapping.MappingProfile),
              typeof(Project3.Mapping.MappingProfile));
  </code></pre>
  <p>i try to scan the folder for the dll's and take the type to register ones :</p>
  <pre><code>var target = typeof(JustForLocation).Assembly;
         
          bool DefaultFilter(Assembly x) =&gt; true;
  
          var path = Path.GetDirectoryName(target.Location) ?? throw new Exception();
  
          var assembliesToLoad = Directory.GetFiles(path, &quot;*.dll&quot;).
              Select(dll =&gt; Assembly.LoadFile(dll))
              .Where(DefaultFilter)
              .ToList();
  
          assembliesToLoad.Add(target);
  
          var types = assembliesToLoad.SelectMany(a =&gt; a.GetExportedTypes()).Where(w =&gt; w.BaseType == typeof(AutoMapper.Profile)).ToArray();
          services.AddAutoMapper(types);
  </code></pre>
  <p>but it's still throw error from the AutoMappe that say:</p>
  <blockquote>
  <p>AutoMapperMappingException: Missing type map configuration or unsupported mapping. Mapping types</p>
  </blockquote>
  <p>any advise why it's happen ?</p>