The following MVC4 Razor layout file loads several script and css bundles created in Bundle.config.
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<title>XXX Beta</title>
@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)
</head>
<body>
<div id="bodyContainer">
@Html.Partial("Partial/_header")
<div id="contentContainer">
<div id="mainContentContainer">
<div id="sidebarContainer">
@RenderSection("sidebarContent", required: true)
</div>
@RenderBody()
</div>
<div class="clearBoth">
</div>
</div>
@Html.Partial("Partial/_footer")
</div>
</body>
</html>
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.
What could be causing the @Scripts and @Styles commands not to be recognized?
Server Error in '/' Application.
Compilation Error
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.
Compiler Error Message: CS0103: The name 'Scripts' does not exist in the current context
Source Error:
Line 4: Line 5: XXX Beta Line 6: @Scripts.Render( Line 7: "~/bundles/bundle_jquery", Line 8: "~/bundles/bundle_modernizr",
Source File: c:\Users\username\Documents\Visual Studio 2010\Projects\XXX\Solution\xxx.website\Views\Shared_sidebarLayout.cshtml Line: 6
Show Detailed Compiler Output:
Show Complete Compilation Source: