5

我有一个使用 MvcContrib 和 MvcScaffold 建立的新项目。动态编译一切正常。但是,当我在项目文件中打开视图编译时,编译会中断。

The name 'model' does not exist in the current context
'System.Web.WebPages.Html.HtmlHelper' does not contain a definition for 'LabelFor' and no extension method 'LabelFor' accepting a first argument of type 'System.Web.WebPages.Html.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)
'System.Web.WebPages.Html.HtmlHelper' does not contain a definition for 'EditorFor' and no extension method 'EditorFor' accepting a first argument of type 'System.Web.WebPages.Html.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)
'System.Web.WebPages.Html.HtmlHelper' does not contain a definition for 'ValidationMessageFor' and no extension method 'ValidationMessageFor' accepting a first argument of type 'System.Web.WebPages.Html.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)

如果您从 Views 文件夹中遗漏了 web.config 文件,这与您收到的错误类型相同,但这是存在的。我也有Phil Haack 的修复程序,但无济于事。为什么 MSBuild 没有找到 MVC3 的好东西?

4

1 回答 1

1

我发现我不小心复制了配置文件中的 system.web 部分,这导致了同样的错误。

于 2013-07-12T14:29:00.183 回答