【发布时间】:2016-06-02 10:27:54
【问题描述】:
我目前正在尝试 ASP.NET Core 1.0 RC2。我已将其创建为 .NET Framework 项目(而不是 .NET Core 项目),并使用 .NET Framework 4.5 通过项目参考添加了对 Models 库的引用:
"frameworks": {
"net46": {
"dependencies": {
"Project.Core": {
"target": "project"
},
"Project.DataAccess": {
"target": "project"
},
"Project.Encryption": {
"target": "project"
},
"Project.Models": {
"target": "project"
},
"Project.Resources": {
"target": "project"
}
}
}
},
现在在我的视图中添加模型指令时,会出现以下错误:
@model System.Collections.Generic.List<Project.Models.User>
The type or namespace name 'Project' could not be found (are you missing a using directive or an assembly reference?)
public class _Views_Home_Index_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<System.Collections.Generic.List<Project.Models.User>>
The type or namespace name 'Project' could not be found (are you missing a using directive or an assembly reference?)
public Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<System.Collections.Generic.List<Project.Models.User>> Html { get; private set; }
它还在智能感知中显示:Cannot resolve tag 'Project.Models.User' 和 Cannot resolve symbol 'model'
我已经添加了一个项目引用,添加了一个 using 语句...仍然出现此错误。这是为什么呢?
【问题讨论】:
标签: c# asp.net asp.net-core-mvc asp.net-core-1.0