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/
更新:这个bug在ASP.NET MVC 4正式版已经没有了。
今天试玩VS2012里的ASP.NET MVC4,用Controller里用Entity Framework生成模版后,发现页面报错CS0103: The name ‘Scripts’ does not exist in the current context。
看了一下原因是MVC4里自动生成的cshtml里都会自动包含下面几行js脚本引用
@section Scripts {
@Scripts.Render(“~/bundles/jqueryval”)
}
@Styles和@Scripts是MVC4里新加的位于System.Web.Optimization下的辅助类,主要用于将多个CSS和JavaScript脚本文件压缩并打包成单个文件。如果项目里没有对System.Web.Optimization,则上面code编译无法通过。
解决方法:在NuGet包管理器里搜索Optimization,安装完毕后在MVC4的web.config里namespace节点下多加一行<add namespace=”System.Web.Optimization” />。
![]()
CS0103: The name ‘Scripts’ does not exist in the current context解决方法的更多相关文章
- The name 'Scripts' does not exist in the current context error in MVC
创建完成ASP.NET MVC4应用程序以后,试着运行其中一个Create页面, 程序报出运行是错误: CS0103: The name 'Scripts' does not exist in th ...
- 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 ...
- .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 ...
- The name ‘InitialzeComponent’ does not exist in the current context
在Visual Studio中创建Windows Store项目,在MainPage.xaml.cs中出现错误: The name 'InitialzeComponent' does not exis ...
- 启动Solr时报 _version_ field must exist in schema 错误的解决方法
Solr启动时报 org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Unable to use up ...
- 关于method not exist:think\db\Query->render错误解决方法
{volist name="Teachers" id="Teachers" key="key"} <tr> <td> ...
- vs 编译错误 The name 'InitializeComponent' does not exist in the current context in WPF application
1:文件命名空间的问题 xaml文件和model.cs文件的命名空间 2:csproj 那么它究竟是给谁用的呢?那是给开发工具用的,例如我们在熟悉不过的Visual Studio,以及大家可以没有接触 ...
- flutter 运行别人项目 包无法导入报错:Target of URI doesn't exist 'package:flutter/material.dart' 解决方法
命令行里运行 flutter packages get
- mysql 直接从date 文件夹备份表,还原数据库之后提示 table doesn`t exist的原因和解决方法
补充:正常情况下,建议数据库备份最好用工具进行备份,通过拷贝数据库表进行数据迁移,不同的环境会出现各种不同的意外问题. 背景:今天在整理一个网站的时候,操作系统由于系统自动更新导致一直出现系统蓝屏死机 ...
随机推荐
- 【Android自学日记】【转】Android Fragment 真正的完全解析(下)
上篇博客中已经介绍了Fragment产生原因,以及一些基本的用法和各种API,如果你还不了解,请看:Android Fragment 真正的完全解析(上). 本篇将介绍上篇博客提到的:如何管理Frag ...
- 复习(1)【Maven】
终于开始复习旧知识了,有输入必然要有输出.输入和输出之间的内化过程尤为重要,在复习的同时,真正把学到的东西积淀下来,加深理解. Maven项目概念与配置 Maven是一个项目管理和综合工具.Maven ...
- Sicily 1215: 脱离地牢(BFS)
这道题按照题意直接BFS即可,主要要注意题意中的相遇是指两种情况:一种是同时到达同一格子,另一种是在移动时相遇,如Paris在(1,2),而Helen在(1,2),若下一步Paris到达(1,1),而 ...
- 【转】Inode详解
Inode详解 转自: Inode详解 一.inode是什么 理解inode,要从文件储存说起. 文件储存在硬盘上,硬盘的最小存储单位叫做"扇区"(Sector).每个扇区储存 ...
- oracle忘记密码
1.输入命令: sqlplus /nolog ,进入oracle控制台,并输入 conn /as sysdba;以DBA角色进入. 2.连接成功后,输入"select username fr ...
- 常用jQuery代码
返回元素的html包括它本身 <div class="test"><p>hello,你好!</p></div> <script ...
- cd命令
[cd] 切换目录 cd===>change directory 命令功能 : 切换目录到dirname 命令实例: 实例1:切换到跟目录下 命令: cd / 输出: ...
- 远程ssh登陆时报错:/bin/bash: Permission denied
远程普通用户ssh登录时,提示/bin/bash: Permission denied,用户名mas,密码正确. 首先上个图,用户远程登录步骤,转自http://www.tldp.org/LDP/LG ...
- UiAutomator--UiAutomatorHelper快速调试
UiAutomatorHelper使用 1.介绍:他是一种可以快速调试的方法:其本身也是java问津相当于自动化脚本,查看该文件,其主要实现的功能如下 1.创建build:android cre ...
- JetBrains PyCharm 2016.2.3注册码
43B4A73YYJ-eyJsaWNlbnNlSWQiOiI0M0I0QTczWVlKIiwibGljZW5zZWVOYW1lIjoibGFuIHl1IiwiYXNzaWduZWVOYW1lIjoiI ...