Skip to main content

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

  • 2 minutes to read

This error can occur in the following cases:

  • ASP.NET MVC 3 projects are upgraded to ASP.NET MVC 4 (or ASP.NET MVC 4 projects to ASP.NET MVC 5)

    Configure the “appSettings” and “assemblies” sections.

    MVC 3 to MVC 4:

    <appSettings>  
        <add key="webpages:Version" value="2.0.0.0" />  
        ...  
    </appSettings>  
    <system.web>  
        <compilation ...>  
            <assemblies>  
                ...  
                <add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />  
                <add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />  
                <add assembly="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />  
            </assemblies>  
        </compilation>  
    </system.web>  
    

    See Also: Upgrading an ASP.NET MVC 3 Project to ASP.NET MVC 4

    MVC 4 to MVC 5:

    Follow steps listed in the following topic: How to Upgrade an ASP.NET MVC 4 and Web API Project to ASP.NET MVC 5 and Web API 2

  • Areas are used.

    Copy DevExpress namespaces from the ~/Views/Web.config configuration file to ~/Areas/AREA_NAME/Web.config configuration file.

    For ASP.NET MVC 4:

    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />  
    

    For ASP.NET MVC 3:

    ~/Areas/AREA_NAME/Web.config:

    <system.web.webPages.razor>  
        <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />  
        <pages pageBaseType="System.Web.Mvc.WebViewPage">  
            <namespaces>  
                <add namespace="System.Web.Mvc" />  
                <add namespace="System.Web.Mvc.Ajax" />  
                <add namespace="System.Web.Mvc.Html" />  
                <add namespace="System.Web.Routing" />  
                <add namespace="DevExpress.Utils" />  
                <add namespace="DevExpress.Web" />  
                <add namespace="DevExpress.Web.ASPxGridView" />  
                <add namespace="DevExpress.Web.ASPxGridView.Export" />  
                <add namespace="DevExpress.Web.ASPxEditors" />  
                <add namespace="DevExpress.Web.ASPxCallbackPanel" />  
                <add namespace="DevExpress.Web.ASPxMenu" />  
                <add namespace="DevExpress.Web.ASPxNavBar" />  
                <add namespace="DevExpress.Web.ASPxPopupControl" />  
                <add namespace="DevExpress.Web.ASPxRoundPanel" />  
                <add namespace="DevExpress.Web.ASPxSplitter" />  
                <add namespace="DevExpress.Web.ASPxTabControl" />  
                <add namespace="DevExpress.Web.ASPxTreeView" />  
                <add namespace="DevExpress.Web.ASPxUploadControl" />  
                <add namespace="DevExpress.Web.ASPxHtmlEditor" />  
                <add namespace="DevExpress.Web.ASPxSpellChecker" />  
                <add namespace="DevExpress.XtraCharts" />  
                <add namespace="DevExpress.XtraCharts.Web" />  
                <add namespace="DevExpress.XtraReports" />  
                <add namespace="DevExpress.XtraReports.UI" />  
                <add namespace="DevExpress.XtraReports.Web" />  
                <add namespace="DevExpress.XtraPivotGrid" />  
                <add namespace="DevExpress.Data.PivotGrid" />  
                <add namespace="DevExpress.Web.ASPxPivotGrid" />  
                <add namespace="DevExpress.Web.ASPxPivotGrid.Export" />  
                <add namespace="DevExpress.Web.Mvc" />  
                <add namespace="DevExpress.Web.Mvc.UI" />  
                <add namespace="DevExpress.XtraScheduler" />  
                <add namespace="DevExpress.XtraScheduler.Native" />  
                <add namespace="DevExpress.Web.ASPxScheduler" />  
            </namespaces>  
        </pages>  
    </system.web.webPages.razor>