2012-04-11 36 views
5

我有一個使用MvcContrib和MvcScaffold構建的新項目。一切工作正常動態編譯。但是,當我在項目文件中啓用視圖編譯時,編譯會中斷。用MvcBuildViews構建剃鬚刀= true失敗

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的好東西?

+0

可能會有點晚,但你看到http://stackoverflow.com/q/4725387/195550? – 2013-05-02 20:02:16

回答

1

我發現我不小心重複了導致相同錯誤的配置文件中的system.web部分。