visual-studio-2010 - 在ASP.NET MVC 3中添加 View 时缺少模型类

标签 visual-studio-2010 asp.net-mvc-3 strongly-typed-view

在我的ASP.NET MVC 3项目中,我引用了DomainModel项目。

当我尝试创建一个强类型的 View 时,会发生问题。在模型类列表中,我来自DomainModel的模型不存在。

我尝试了以下尝试,但没有成功(来自另一个线程):

-remove reference to the library containing the model
-clean project
-close VS
-reopen VS
-rebuild project (VS throws errors)
-re-add reference to the model library
-rebuild project

我也试图将VS2010更新为VS2010 SP1相同的问题。

有什么建议吗?

最佳答案

好吧,如果您在对话框中看不到模型,请尝试从这样的 View 中直接调用它:

@model  IEnumerable<Ieagle.WebSelfCare.Models.InvoicingIndex>

如果您有IEnumerable模型,否则
@model Ieagle.WebSelfCare.Models.Person

如果您无法达到这样的模型,则可能是模型内有问题

关于visual-studio-2010 - 在ASP.NET MVC 3中添加 View 时缺少模型类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6422607/

相关文章:

javascript - 如何使用 html.beginform 从服务器端获取结果?

c# - 我如何使用ftp服务器上传文件?

c# - T4MVC 或 MvcFutures 用于 View 中的强类型链接

c++ - C++ 中的文件 I/O 代码

vb.net - VS2010 提示 Microsoft.VisualBasic 依赖

visual-studio-2010 - 在Apps exe中创建文件夹。是

asp.net-mvc-3 - ASP.NET MVC 强类型 HTML 帮助程序

c# - HRESULT 异常 : 0x80131040

asp.net-mvc-3 - mvc 3.0 中的验证规则

asp.net-mvc - ASP.NET MVC,强类型 View ,部分 View 参数故障