Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building Razor with MvcBuildViews=true failing

I have a new project built up using MvcContrib and MvcScaffold. Everything works fine with dynamic compilation. When I turn on view compilation in the project file, however, compilation breaks.

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?)

It's the same kind of errors you'd receive if you left out the web.config file from the Views folder, but that's present. I also have Phil Haack's fix in already, to no avail. Why isn't MSBuild finding the MVC3 goodies?

like image 512
roufamatic Avatar asked Nov 14 '22 07:11

roufamatic


1 Answers

I found that I had accidentally duplicated the system.web section in my configuration file which caused the same error.

like image 161
The Senator Avatar answered Dec 26 '22 01:12

The Senator