【发布时间】:2012-06-18 19:26:23
【问题描述】:
尝试使用强类型视图打开 ASP.NET MVC3 网站时出现以下错误。
Compiler Error Message: CS0234: The type or namespace name 'Survey' does not exist in the namespace 'MyWeb.Models' (are you missing an assembly reference?)
public class _Page_Views_Home_Survey_cshtml : System.Web.Mvc.WebViewPage<MyWeb.Models.Survey> {
注意:
- 我的解决方案中只有一个项目。
- MyWeb.Models.Survey 存在并且是公开的。
- 在我的 Survey.cshtml 文件中,我可以完全访问智能感知。
- 找到非强类型工作的页面。
- 在我的网络配置中,我有以下内容:
有人知道如何解决这个问题吗?
【问题讨论】:
-
您引用的是哪个版本的 MVC DLL?您是否有可能引用 MVC2 而不是 MVC3?此外,仔细检查框架目标可能是谨慎的。
-
@Ross - MVC 是 3.0.0.0 版。目标框架是 .NET 4.0。
-
已编辑以修复配置 html 编码
标签: asp.net-mvc-3 namespaces strongly-typed-view