ASP.NET Microsoft 教程中的 Core View 错误
ASP.NET Core View error in Microsoft Tutorial
在 ASP.NET 核心网络应用上 Microsoft Tutorial 之后,我收到以下错误:
The type or namespace name 'EFGetStarted.AspNetCore.NewDb' could not be found (are you missing a using directive or an assembly reference?)
注意:EFGetStarted.AspNetCore.NewDb
是项目的名称,它出现在智能感知中,但.Models.Blog
部分没有出现在智能感知中。
部分视图如下所示。整个视图可见上图link。错误发生在视图的第一行。我什至尝试将 @using EFGetStarted.AspNetCore.NewDb.Models
作为视图的第一行,但仍然出现相同的错误。我或教程缺少什么?我仔细检查了拼写,并 copied/pasted 教程中的代码以确保拼写正确:
@model IEnumerable<EFGetStarted.AspNetCore.NewDb.Models.Blog>
@{
ViewBag.Title = "Blogs";
}
<h2>Blogs</h2>
........
我在 Windows 8.1
上使用 ASP.NET Core 1.0 and VS2015-Update 3
[2016 年 6 月 27 日发布] 的最新版本
每当您遇到异常,例如是否缺少 using 指令或程序集引用?请转到模型 class,复制命名空间并编写 @using 命名空间。这有助于解决命名空间问题。
在 ASP.NET 核心网络应用上 Microsoft Tutorial 之后,我收到以下错误:
The type or namespace name 'EFGetStarted.AspNetCore.NewDb' could not be found (are you missing a using directive or an assembly reference?)
注意:EFGetStarted.AspNetCore.NewDb
是项目的名称,它出现在智能感知中,但.Models.Blog
部分没有出现在智能感知中。
部分视图如下所示。整个视图可见上图link。错误发生在视图的第一行。我什至尝试将 @using EFGetStarted.AspNetCore.NewDb.Models
作为视图的第一行,但仍然出现相同的错误。我或教程缺少什么?我仔细检查了拼写,并 copied/pasted 教程中的代码以确保拼写正确:
@model IEnumerable<EFGetStarted.AspNetCore.NewDb.Models.Blog>
@{
ViewBag.Title = "Blogs";
}
<h2>Blogs</h2>
........
我在 Windows 8.1
上使用ASP.NET Core 1.0 and VS2015-Update 3
[2016 年 6 月 27 日发布] 的最新版本
每当您遇到异常,例如是否缺少 using 指令或程序集引用?请转到模型 class,复制命名空间并编写 @using 命名空间。这有助于解决命名空间问题。