创建完成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. Skrollr.js -- 使用Skrollr创建视差滚动效果页面

    使用方法:  http://www.helloweba.com/view-blog-262.html http://www.uedsc.com/skrollr.htmlhttp://www.hello ...

  2. 盘点十大最流行的Linux服务器发行版

    随着Linux不断发展,Linux所支持的文件系统类型也在迅速扩充.很多的数据中心服务器上都运行着Linux,可以节省大量的许可证费用及维护费用.但伴随着Linux新版本的发行,其中每一个不同版本的L ...

  3. linux tar 增量备份命令

    tar --newer-mtime "2013-09-17 00:00:00"   -zcvf /var/www/good.tar.gz    spider/

  4. mysql 5.7 zip 文件在 windows下的安装

    1.下载mysql最新版本. http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.15-winx64.zip 2.解压到文件夹. D:\softwa ...

  5. Redis persistence demystified - part 1

    关于Redis我的一部分工作是阅读博客,论坛以及twitter时间线(time line).对于开发者来说,能够了解用户社区,非用户社区如果理解他正在开发的产品是非常重要的.据我所知,持久化特性是最易 ...

  6. NoSQL分类

    NoSQL数据库分类: NoSQL DEFINITION:Next Generation Databases mostly addressing some of the points: beingno ...

  7. 快餐问题(dp好题)

    Peter最近在R市开了一家快餐店,为了招揽顾客,该快餐店准备推出一种套餐,该套餐由A个 汉堡,B个薯条和C个饮料组成.价格便宜.为了提高产量,Peter从著名的麦当劳公司引进了N条 生产线.所有的生 ...

  8. Python的排序

    1.reversed() 这个很好理解,reversed英文意思就是:adj. 颠倒的:相反的:(判决等)撤销的 print list(reversed(['dream','a','have','I' ...

  9. struts中的常量,action配置中的默认值

    1.struts中Action的开发方式 继承ActionSupport类,这种方法实现的Action可以进行数据校验: 实现Action接口: 不继承任何类,不实现任何接口: 是否继承类或实现接口, ...

  10. K2认证考试,为竞争力加分

    思科Cisco认证.ADOBE认证.微软认证.印度AIIT认证.华为认证.IBM认证等……在各种“证”满天飞的时候,如何独具慧眼选择最有含金量的证书? 八成 的人力资源主管会检查求职者的认证情况.(C ...