【问题标题】:Building Razor with MvcBuildViews=true failing使用 MvcBuildViews=true 构建 Razor 失败
【发布时间】:2012-04-11 17:44:09
【问题描述】:

我有一个使用 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?)

如果您使用left out the web.config file from the Views folder,您会收到相同类型的错误,但这是存在的。我也有Phil Haack's fix,但无济于事。为什么 MSBuild 找不到 MVC3 好东西?

【问题讨论】:

标签: asp.net asp.net-mvc-3 razor msbuild


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-06-22
    • 2012-05-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多