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

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

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

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

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

Tools -> Library Package Manager -> Package Manager Console

安装

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

  1. 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. Python输出内容的三种方式:print输出 python脚本执行 linux直接执行

    1.  在linux中安装python后,在linux命令行中输入python即可切换到Python命令行下 退出python命令行的命令: 老版本:ctrl+D 新版本:quit();或exit() ...

  2. 生产订单修改删除组件BDC

    可用函数修改:CO_XT_COMPONENT_CHANGE,一次一个 FORM prm_change_bom . DATA:gw_zstypf TYPE zstypf. DATA:lv_rspos T ...

  3. hadoop学习笔记:hadoop文件系统浅析

    1.什么是分布式文件系统? 管理网络中跨多台计算机存储的文件系统称为分布式文件系统. 2.为什么需要分布式文件系统了? 原因很简单,当数据集的大小超过一台独立物理计算机的存储能力时候,就有必要对它进行 ...

  4. Mysql多表关联删除操作

    直接看Sql即可: ;

  5. 转python编码问题

    python的编码问题 http://blog.csdn.net/fuadam/article/details/5547504 分类: .net以外的东东 2010-04-30 21:16 747人阅 ...

  6. quartz Web项目基础最简单配置

    web方面的quartz 配置资料,从网上搜索出来的很难找到完整可用的代码样例.自己上传一个. IDE:Intellij tomcat jdk1.7 quartz 2.1.5 这里下载: http:/ ...

  7. Java中的String与常量池[转帖]

    string是java中的字符串.String类是不可变的,对String类的任何改变,都是返回一个新的String类对象.下面介绍java中的String与常量池. 1. 首先String不属于8种 ...

  8. POJ 1125 Stockbroker Grapevine 最短路 难度:0

    http://poj.org/problem?id=1125 #include <iostream> #include <cstring> using namespace st ...

  9. 佳佳的魔法药水 (vijos 1285)

    题目大意: 给出N种药水的价格,然后给出一些形如A B C 的关系,表示 A药水+B药水 可以组合出 C药水(保证 A+B 不会得到多种药水). 要求得到1号药水的最少花费和相应的方案数. N< ...

  10. encodeURI

    encodeURI("http://www.cnblogs.com/season-huang/some other thing"); //整个URL进行编码"http:/ ...