Enabling MvcBuildView for MvcSiteMapProvider

I am working on an MVC 5 project using MvcBuildViews and MvcSiteMapProvider. We are trying to enable MvcBuildViews by editing the project file with

<MvcBuildViews>true</MvcBuildViews>

      

and

<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
    <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>

      

After that we try to create a website. The compiler returns these errors in SiteMapProvider templates:

  • The name "model" does not exist in the current context. c: \ inetpub \ wwwroot \ XXXXXXX \ packages \ MvcSiteMapProvider.Web.4.6.1 \ content \ Views \ Shared \ DisplayTemplates \ SiteMapHelperModel.cshtml

  • 'System.Web.WebPages.Html.HtmlHelper' does not contain a definition for 'DisplayFor' and no extension method 'DisplayFor' that takes a first argument of type 'System.Web.WebPages.Html.HtmlHelper' (you don't see the using directive or reference to assembly?) c: \ inetpub \ wwwroot \ XXXXXXX \ packages \ MvcSiteMapProvider.Web.4.6.1 \ content \ Views \ Shared \ DisplayTemplates \ SiteMapNodeModelList.cshtml

What do I need to do to get MvcBuildViews to work with the SiteMapProvider? Is there a tag missing in the web.config file or something similar?

+3


source to share





All Articles