Using Script.Require in .cshtml file

Feb 10, 2011 at 12:02 PM

I keep getting the error :

Compiler Error Message: CS0103: The name 'Script' does not exist in the current context

Source Error:

Line 6:  @*using System.Web.Script;*@
Line 7:
Line 8: @Script.Require("flowPlayer");
Line 9:
Line 10:

I seem to be having problem trying to use the Script.require method in my razor file:

@using System.Web.Routing;
@using Orchard.Utility.Extensions;
@model Flowplayer.Models.Video



I have reference the .js file in my ResourceManifest.cs file:


namespace FlowPlayer {
    using Orchard.UI.Resources;
    public class ResourceManifest : IResourceManifestProvider {
        public void BuildManifests(ResourceManifestBuilder builder) {
            var manifest = builder.Add();
            //manifest.DefineScript("jQuery").SetUrl("jquery-1.4.2.min.js", "jquery-1.4.2.js").SetVersion("1.4.2");
            // todo: include min versions



I think it could be the fact that I had to change some references in the web.config file which might be missing an assembly in order to use the "Script.require" method in Orchard.

My web.config looks like :

<?xml version="1.0"?>
  For more information on how to configure your ASP.NET application, please visit

        <add key="ClientValidationEnabled" value="true"/>
        <add key="UnobtrusiveJavaScriptEnabled" value="true"/>

        <compilation debug="true" targetFramework="4.0">
                <add assembly="System.Web.Abstractions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Web.Helpers, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Web.Routing, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Web.WebPages, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <!--<add assembly="System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />-->
                <add namespace="System.Web.Helpers" />
                <!--<add namespace="System.Web.Extensions" />-->
                <add namespace="System.Web.Mvc" />
                <add namespace="System.Web.Mvc.Ajax" />
                <add namespace="System.Web.Mvc.Html" />
                <add namespace="System.Web.Routing" />
                <add namespace="System.Web.WebPages"/>
                <add namespace="Orchard.Mvc.Html"/>
                <add namespace="System.Linq"/>
                <add namespace="System.Collections.Generic"/>

        <validation validateIntegratedModeConfiguration="false"/>
        <modules runAllManagedModulesForAllRequests="true"/>

        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
                <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="" newVersion="" />


Any help would be much appreciated!


Feb 10, 2011 at 5:28 PM

Why did you have to change web.config?