Search code examples
c#htmlasp.net-mvcrazorumbraco

Umbraco MVC build error - Collection.cshtml - 'System.Web.WebPages.Html.HtmlHelper' does not contain a definition for 'ViewData' or 'EditorFor'


I am getting a build error for an Umbraco MVC website:

'System.Web.WebPages.Html.HtmlHelper' does not contain a definition for 'ViewData' 'System.Web.WebPages.Html.HtmlHelper' does not contain a definition for 'EditorFor'

The error relates to a file in the packages folder:

....\packages\BeginCollectionItem.1.2.1.0\content\Views\Shared\EditorTemplates\Collection.cshtml

I can add the web.config file in the Views folder in there, which resolves this particular issue, but then starts complaining about a missing reference to 'Orchard', and I am concerned that I am just masking a deeper issue.

Has anyone come across this before? If so, how was it resolved?


Solution

  • The issue was in the csproj file. MvcBuildViews was set to true.