Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type namespace name IdentityUser could not be found

I keep getting this error for the last two frameworks that I have included. I have searched up and down. Can't figure what it is. I have installed the NuGet packages and tried to recompile multiple times. Nothing is working. Here is my code.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using IdentityUser;
using IdentityDbContext;

namespace UserProfileInfo.Models
{
    public class UserProfile : IdentityUser
    {
        public virtual UserProfile UserInfo { get; set; }
    }

    public class UserProfileDB
    {
        public int Id { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
    }
    public class MyDbContext : IdentityDbContext<UserProfile>
    {
        public MyDbContext()
            : base("DefaultConnection")
        {

        }
        public System.Data.Entity.DbSet<UserProfile> UserInfo { get; set; }
    }
}
like image 562
cp-stack Avatar asked Feb 08 '14 05:02

cp-stack


3 Answers

This is for Dotnet Core and you will not receive any warning

using Microsoft.Extensions.Identity.Stores

like image 199
Dennis Don Avatar answered Oct 15 '22 12:10

Dennis Don


There is no needs for -

using IdentityUser;
using IdentityDbContext;

Instead you need to add following -

using Microsoft.AspNet.Identity.EntityFramework;

Make sure you have that DLL as a reference as shown below. If it is not available, then you can get that nuget from here.

enter image description here

like image 31
ramiramilu Avatar answered Oct 15 '22 11:10

ramiramilu


For AspNet Core 1 use NuGet:

Microsoft.AspNetCore.Identity.EntityFrameworkCore

For AspNet Core 2 use NuGet:

Microsoft.AspNetCore.Identity

like image 2
profimedica Avatar answered Oct 15 '22 12:10

profimedica