title: ASP.Net MVC4 Root cshtml and "does not inherit from 'System.Web.WebPages.WebPage"
body: <p>I have followed the answers provided by very similar posts as you will see in the step by step listed below.</p>
  
  <ul>
  <li><p><a href="https://stackoverflow.com/questions/10460913/razor-view-type-does-not-inherit-from-system-web-webpages-webpage">Razor view Type does not inherit from &#39;System.Web.WebPages.WebPage&#39;</a></p></li>
  <li><p><a href="http://iamdotnetcrazy.blogspot.com/2012/08/how-to-solve-type-asppageviewstartcshtm.html" rel="nofollow noreferrer">http://iamdotnetcrazy.blogspot.com/2012/08/how-to-solve-type-asppageviewstartcshtm.html</a></p></li>
  </ul>
  
  <p>I still have the same error message "does not inherit from 'System.Web.WebPages.WebPage'"</p>
  
  <h2>Overview</h2>
  
  <p>I am learning from John Papa's "Single Page Apps with HTML5, Web API, Knockout and jQuery" on Pluralsight.  The course outlines building an application called "Code Camper".  The example MVC4 SPA creates a root view called "index.cshtml".  where a series of @RenderPage calls are made.  This application runs fine on my development machine. However, if i try to create from scratch a MVC4 SPA with a root view.cshtml I always get the error "does not inherit from 'System.Web.WebPages.WebPage"</p>
  
  <h2>Step by Step</h2>
  
  <p>Download <a href="https://skydrive.live.com/redir?resid=EDAFB4DBECFEE2EA!4849&amp;authkey=!ACSorle8q0hebwY" rel="nofollow noreferrer">here</a>.</p>
  
  <p>1.Create a new MVC4 Internet Project called "MVC4RootView"</p>
  
  <p>2.In the root of the project, create a RootView.cshtml view.</p>
  
  <pre><code>@{
  Layout = null;
  }
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta name="viewport" content="width=device-width" /&gt;
      &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div&gt;
              @RenderPage("Views/Partial1.cshtml")
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>3.Added a “~/Views/Partial1.cshtml” with just a simple div</p>
  
  <pre><code>&lt;div&gt;Hello from Partial 1&lt;/div&gt;
  </code></pre>
  
  <p>4.Modified root Web.Config webpages:Enabled to true.</p>
  
  <pre><code>&lt;add key="webpages:Enabled" value="true" /&gt;
  </code></pre>
  
  <p>5.Added system.web.webPages.razor to root Web.config</p>
  
  <pre><code>&lt;system.web.webPages.razor&gt;
    &lt;host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
    &lt;pages pageBaseType="System.Web.Mvc.WebViewPage"&gt;
      &lt;namespaces&gt;
        &lt;add namespace="System.Web.Mvc" /&gt;
        &lt;add namespace="System.Web.Mvc.Ajax" /&gt;
        &lt;add namespace="System.Web.Mvc.Html" /&gt;
        &lt;add namespace="System.Web.Optimization"/&gt;
        &lt;add namespace="System.Web.Routing" /&gt;
      &lt;/namespaces&gt;
    &lt;/pages&gt;
  &lt;/system.web.webPages.razor&gt;
  </code></pre>
  
  <p>6.Added sectionGroup name="system.web.webPages.razor" to configSections of root web.config</p>
  
  <pre><code>&lt;sectionGroup name="system.web.webPages.razor"
      type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup,
      System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral,
      PublicKeyToken=31BF3856AD364E35"&gt;       
      &lt;section name="host"
          type="System.Web.WebPages.Razor.Configuration.HostSection,
          System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral,
          PublicKeyToken=31BF3856AD364E35" requirePermission="false" /&gt;
      &lt;section name="pages"
          type="System.Web.WebPages.Razor.Configuration.RazorPagesSection,
          System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral,
          PublicKeyToken=31BF3856AD364E35" requirePermission="false" /&gt;
  &lt;/sectionGroup&gt;
  </code></pre>
  
  <p>7.Set RootView.cshtml as Start Page</p>
  
  <p>8.Run and get the following error:  "Type 'ASP._Page_RootView_cshtml' does not inherit from 'System.Web.WebPages.WebPage'.</p>
  
  <p>I am at a loss of how to fix this.  The Code Camper code works fine.  I have compared line by line and see no differences in the code that would prevent from working.</p>
  
  <p>Thoughts?
  Dan</p>