Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9252863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:03:53+00:00 2026-06-18T11:03:53+00:00

The following MVC4 Razor layout file loads several script and css bundles created in

  • 0

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:

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:03:54+00:00Added an answer on June 18, 2026 at 11:03 am

    Make sure that the System.Web.Optimization.dll assembly has been referenced in your project and that the <add namespace="System.Web.Optimization"/> namespace has been added to your ~/Views/web.config file (not ~/web.config file):

    <system.web.webPages.razor>
        <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.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.Optimization"/>
            <add namespace="System.Web.Routing" />
          </namespaces>
        </pages>
    </system.web.webPages.razor>
    

    The System.Web.Optimization.dll assembly is contained within the Microsoft.AspNet.Web.Optimization NuGet, so make sure that it is installed in your project (when you create a new ASP.NET MVC 4 project in Visual Studio using the Internet Template this NuGet is automatically added to the project).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following razor helper functions in a cshtml file, it works at
I created simple site using MVC4 Mobile template. On index.cshtml I put following links
I have the following Javascript and Html code that works fine in an MVC4
Following chunk html code works as expected: <iframe src=http://www.amazon.com/></iframe> But when trying embed inner
I am creating a C# MVC4.5 project using entity framework with the following connection
I am developing a JQuery mobile application in ASP.net MVC4 razor using VSRC, In
I have an asp.net MVC3 project I made an upgrade to asp.net mvc4 following
i am new to asp.net MVC4 architecture i am get stuck with following thing
I am following this tutorial to practice MVC-4: http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-new-field-to-the-movie-model-and-table I am not doing the
I'm trying out the MVC4 System.Web.Optimization 1.0 ScriptBundle feature . I have the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.