cp-stack
cp-stack

Reputation: 876

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; }
    }
}

Upvotes: 14

Views: 22995

Answers (3)

Dennis Don
Dennis Don

Reputation: 287

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

using Microsoft.Extensions.Identity.Stores

Upvotes: 8

profimedica
profimedica

Reputation: 2840

For AspNet Core 1 use NuGet:

Microsoft.AspNetCore.Identity.EntityFrameworkCore

For AspNet Core 2 use NuGet:

Microsoft.AspNetCore.Identity

Upvotes: 2

ramiramilu
ramiramilu

Reputation: 17182

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

Upvotes: 26

Related Questions