Click here to Skip to main content
15,909,332 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I have already added the using directive ( using API.Helpers)in the applicationServiceExtension file for the AutoMapperProfiles still it's giving me an error.

Error: AutoMapperProfiles :"The type or namespace name 'AutoMapperProflies' could not be found (are you missing a using directive or an assembly reference?)

What I have tried:

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using API.Data;
using API.Interfaces;
using API.Services;
using API.Helpers;
using System.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;


namespace API.Extensions
{
    public static class ApplicationServiceExtensions
    {
        public static IServiceCollection AddApplicationServices(this IServiceCollection services, IConfiguration config)
        {
            services.AddScoped<itokenservice, tokenservice="">();
            services.AddScoped<iuserrepository, userrepository="">();
            services.AddAutoMapper(typeof(AutoMapperProflies).Assembly);
            services.AddDbContext<datacontext>(options =>
            {
                options.UseSqlite(config.GetConnectionString("DefaultConnection"));
            });
            return services;

        }
    }
}
Posted
Updated 24-Jun-22 4:43am
v2

C#
services.AddAutoMapper(typeof(AutoMapperProflies).Assembly);

Most likely because that should be spelled AutoMapperProfiles
 
Share this answer
 
Error: AutoMapperProfiles :"The type or namespace name 'AutoMapperProflies' could not be found

Refers to this:
C#
services.AddAutoMapper(typeof(AutoMapperProflies).Assembly);

Have you checked that you have added the library? Is the name correct? Are you sure that you have the correct namespace?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900