title: Why are @Scripts and @Styles commands not be recognized in MVC4 Razor layout file?
body: <p>The following MVC4 Razor layout file loads several script and css bundles created in Bundle.config.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html class="no-js" lang="en"&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8" /&gt;
    &lt;title&gt;XXX Beta&lt;/title&gt;
    @Scripts.Render(
    "~/bundles/bundle_jquery",
    "~/bundles/bundle_modernizr",
    "~/bundles/bundle_foundation",
    "~/bundles/bundle_jhs")
    @Styles.Render(
    "~/Content/bundle_foundation",
    "~/Content/bundle_jhs")
    @RenderSection("pageHeadContent", false)
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div id="bodyContainer"&gt;
      @Html.Partial("Partial/_header")
      &lt;div id="contentContainer"&gt;
        &lt;div id="mainContentContainer"&gt;
          &lt;div id="sidebarContainer"&gt;
            @RenderSection("sidebarContent", required: true)
          &lt;/div&gt;
          @RenderBody()
        &lt;/div&gt;
        &lt;div class="clearBoth"&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      @Html.Partial("Partial/_footer")
    &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When the page is rendered the following error occurs. For some reason the @Scripts and @Styles commands are not being recognized. If I type in "@Scripts" in the files the Intellisense does not display/show the command. The project does reference System.Web.Optimization, which is used in the Bundle.config.</p>
  
  <p>What could be causing the @Scripts and @Styles commands not to be recognized?</p>
  
  <hr>
  
  <p>Server Error in '/' Application.</p>
  
  <p>Compilation Error</p>
  
  <p>Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. </p>
  
  <p>Compiler Error Message: CS0103: The name 'Scripts' does not exist in the current context</p>
  
  <p>Source Error:</p>
  
  <p>Line 4:    
  Line 5:    XXX Beta
  Line 6:    @Scripts.Render(
  Line 7:        "~/bundles/bundle_jquery",
  Line 8:        "~/bundles/bundle_modernizr",</p>
  
  <p>Source File: c:\Users\username\Documents\Visual Studio 2010\Projects\XXX\Solution\xxx.website\Views\Shared_sidebarLayout.cshtml    Line: 6 </p>
  
  <p>Show Detailed Compiler Output:</p>
  
  <p>Show Complete Compilation Source:</p>
  
  <h2>Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272</h2>