创建完成ASP.NET MVC4应用程序以后,试着运行其中一个Create页面, 程序报出运行是错误:

CS0103: The name 'Scripts' does not exist in  the current context

问题根源是Create页面是MVC自动创建的, 在自动创建时添加了一段代码:

@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}

解决方法:
在VS中打开Package Manager Console

Tools -> Library Package Manager -> Package Manager Console

安装

在Package Manager Console中输入命令并运行

Install-Package Microsoft.AspNet.Web.Optimization

添加对System.Web.Optimization的引用
将<addnamespace="System.Web.Optimization"/>添加到Web.config的命名空间部分。两个web.config中都要添加, 程序根目录中的和Views文件夹中的。

The name 'Scripts' does not exist in the current context error in MVC的更多相关文章

  1. CS0103: The name ‘Scripts’ does not exist in the current context解决方法

    转至:http://blchen.com/cs0103-the-name-scripts-does-not-exist-in-the-current-context-solution/ 更新:这个bu ...

  2. MVC:The name 'Scripts' does not exist in the current context

    汇总:http://www.cnblogs.com/dunitian/p/4523006.html#efmvc 解决:在View下面的Web.Config的namespaces添加 <add n ...

  3. .ascx.g.cs文件不能生成 The name ‘InitializeControl’ does not exist in the current context - Visual Web part Sharepoint

    InitializeControl doesn't exsit When using visual studio 2012 for developing SharePoint 2013 Visual ...

  4. The name ‘InitialzeComponent’ does not exist in the current context

    在Visual Studio中创建Windows Store项目,在MainPage.xaml.cs中出现错误: The name 'InitialzeComponent' does not exis ...

  5. vs 编译错误 The name 'InitializeComponent' does not exist in the current context in WPF application

    1:文件命名空间的问题 xaml文件和model.cs文件的命名空间 2:csproj 那么它究竟是给谁用的呢?那是给开发工具用的,例如我们在熟悉不过的Visual Studio,以及大家可以没有接触 ...

  6. 【转】关于编写WPF UserControl时提示The name 'InitializeComponent' does not exist in the current contextr的解决!

    1.打开.csproj(工程)文件. 2.找到<Import Project="$(MSBuildBinPath)/Microsoft.CSharp.targets" /&g ...

  7. pppd - 点对点协议守护进程

    总览 SYNOPSIS pppd [ tty_name ] [ speed ] [ options ] 描述 点对点协议 (PPP) 提供一种在点对点串列线路上传输资料流 (datagrams)的方法 ...

  8. ip-up脚本参数

    pppoe连接建立后,系统自动调用/etc/ppp/ip-up脚本. 其参数如下面文件所示,第4个参数是系统获得的动态ip.#!/bin/bash## Script which handles the ...

  9. [译]:Xamarin.Android开发入门——Hello,Android快速上手

    返回索引目录 原文链接:Hello, Android_Quickstart. 译文链接:Xamarin.Android开发入门--Hello,Android快速上手 本部分介绍利用Xamarin开发A ...

随机推荐

  1. js基础练习---图片无缝左右滚动效果(主要以复制删除为主)

    昨天闲来没事 看了下图片效果  发现这个方法j 就自己模仿下 上代码  当中有很多的纰漏 请大神们多多指教一二? <script type="text/javascript" ...

  2. go——搭建Win7下的Go开发环境

    1.首先需要下载下载go平台安装包 安装程序 下载地址:https://golang.org/dl/ (墙内下载地址http://www.golangtc.com/download),如果是您的系统是 ...

  3. 为不同浏览器创建XMLHttpRequest对象

    /*声明一个XMLHttpRequest对象*/ var xmlHttp=false; /*@cc_on@*/ /*if(@_jscript_version>=5) try { xmlHttp= ...

  4. Js数据类型之——Date

    小猪曾经分享过一篇文章,主要是讲到后台使用c#将DataTime类型序列化到前台之后进行操作:具体请看传送门 今天小猪来分享在JS中的Data类型 类型说明 ECMAScript中的Data类型是在早 ...

  5. HADOOP 2架构图

    HDFS 2 architecture YARN architecture

  6. [Js]滑动门效果

    描述:鼠标移动到一副图片上,会显示该副图片的全貌,而其他图片会显示概貌 一.没有动画效果的运动 思路: 1.定好每张图片的初始位置(第一张完全显示,234只露出一部分) 2.计算每道门的移动距离(即未 ...

  7. 河流 tyvj1506

    题目大意: 给出一棵n个节点的有根树,一开始 树根 是一个控制点,现在要增加m个控制点,使得总费用最少. 给出每个节点的父节点以及到父节点的距离,还有这个节点的权值, 一个节点的费用 即它的权值 乘以 ...

  8. C#遍历窗体所有控件或某类型所有控件

    //遍历窗体所有控件, foreach (Control control in this.Controls) { //遍历后的操作... control.Enabled = false; } 遍历某个 ...

  9. LibLinear(SVM包)使用说明之(一)README

    转自:http://blog.csdn.net/zouxy09/article/details/10947323/ LibLinear(SVM包)使用说明之(一)README zouxy09@qq.c ...

  10. 大开眼界 游览Facebook香港办公室

    想加入Facebook 的话不一定要跑去美国,Facebook在香港也开了一个很赞的办公室.除了无敌海景外,更可享用按摩椅.乒乓球桌.跑步机.麻将桌.酒廊.育婴室及开放式厨房.