1

Closed

'System.Web.WebPages.Html.HtmlHelper' does not contain a definition for 'RenderPartial' & The name 'Content' does not exist in current context

description

Hello, I have these errors listed in Visual Studio:
'System.Web.WebPages.Html.HtmlHelper' does not contain a definition for 'RenderPartial'
The name 'Content' does not exist in current context

(see attachment)

There are numerous errors in each and every single .cshtml file in my Views folder, yet the site fully loads and functions perfectly fine, both in debug mode and published / released.

I run N2 CMS on what was a clean MVC 5 project in VS13, and had the Default template of N2 Dinamico moved over to my views folder as a 'base' to work out from.

I have a web.config inside the Views folder, with the following, but not limited to;
<configuration>
    <configSections>
        <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor">
            <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor" requirePermission="false" />
            <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor" requirePermission="false" />
        </sectionGroup>

    </configSections>

    <system.web.webPages.razor>
        <!--<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc" />-->
        <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <pages pageBaseType="N2.Web.Mvc.ContentWebViewPage">
            <!--<pages pageBaseType="System.Web.Mvc.WebViewPage">-->
            <namespaces>
                <add namespace="System.Web.Optimization" />
                <add namespace="System.Web.Mvc" />
                <add namespace="System.Web.Mvc.Ajax" />
                <add namespace="System.Web.Mvc.Html" />
                <add namespace="System.Web.Routing" />
                <add namespace="N2.Web.Mvc.Html" />
                <add namespace="N2.Definitions.Runtime" />
            </namespaces>
        </pages>
    </system.web.webPages.razor>
Without this web.config file, I get these exact errors reported during launch in debug mode, but as mentioned, with the above the code executes perfectly fine but VS reports it as errors.

At this point, I do not know where to look to find the cause of this.

file attachments

Closed Nov 30, 2014 at 6:58 AM by bherila
Cannot reproduce the issue.

comments