2014-02-08 96 views
4

我一直收到我包含的最後兩個框架的這個錯誤。我搜索了上下。無法確定它是什麼。我已經安裝了NuGet軟件包,並嘗試多次重新編譯。沒有任何工作。這是我的代碼。無法找到類型名稱空間名稱IdentityUser

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

@堆流可以添加 - '使用Microsoft.AspNet.Identity.EntityFramework;',讓我知道會發生什麼?同樣在參考文獻中,您會看到我們是否添加了該DLL。 – ramiramilu

回答

11

不存在用於需求 -

using IdentityUser; 
using IdentityDbContext; 

相反,你需要添加以下 -

using Microsoft.AspNet.Identity.EntityFramework; 

確保您有一個作爲參照,如下圖所示DLL。如果它不可用,那麼你可以從here獲得該nuget。

enter image description here

+0

像一個魅力工作。非常感謝! –

相關問題