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的原因和解决方法
补充:正常情况下,建议数据库备份最好用工具进行备份,通过拷贝数据库表进行数据迁移,不同的环境会出现各种不同的意外问题. 背景:今天在整理一个网站的时候,操作系统由于系统自动更新导致一直出现系统蓝屏死机 ...
随机推荐
- linux第二天
由于今天公司事情比较多,今天基本没有自学.了解了一下type命令:主要是显示命令类型的命令.linux命令分为内置命令和外部命令两种.内置命令就shell内置的命令,外部命令,就是需要有系统存在一个名 ...
- EXCEL 2010学习笔记 —— VLOOKUP函数 嵌套 MATCH 函数
match index vlookup 等函数都是查找引用类函数,需要查找的时候关键变量只有两个,区域+位置,区域的选择注意是否需要锁定,位置的确定可以通过输入特定的行号和列号. match() ma ...
- 用Burpsuite破解网站密码
burpsuite专业版 一个网站 方法/步骤 1 切换至proxy选项卡的Option选项下,设置代理地址和端口:127.0.0.1:8080. 2 启动刚刚设置的代理 3 打开Internet ...
- SPOJ FTOUR2 - Free tour II
Description 有些黑点,问你选择不超过 \(k\) 个黑点的路径,路径权值最大是多少. Sol 点分治. 这是qzc的论文题,不过我感觉他的翻译好强啊...我还是选择了自己去看题目... 点 ...
- 阿里云部署nodejs服务器(windows)
花了大半个月做的网站终于要上线了,周围的同学们很多都在使用阿里云的服务器,我也入手了一台.考虑到自己不是很适应ubuntu的命令行界面,于是买了个windows的,上网搜了一下,似乎都是用linux来 ...
- powershell批量设置权限
批量设置权限 $acl=get-acl .\demo Get-ChildItem .\Documents -Recurse -Force|Set-Acl -AclObject $acl
- HTTP状态码
http状态码负责表示客户端HTTP请求的返回结果.标记服务器端的处理是否正常.通知出现的错误等工作. 状态码类别分组如下: 1. 1XX: informational(信息性状态码) 接收的请求正 ...
- 懒加载插件- jquery.lazyload.js
Lazy Load 是一个用 JavaScript 编写的 jQuery 插件. 它可以延迟加载长页面中的图片. 在浏览器可视区域外的图片不会被载入, 直到用户将页面滚动到它们所在的位置. 这与图片预 ...
- jquery的checkbox,radio,select等方法总结
jquery的checkbox,radio,和select是jquery操作的一个难点和重点,很多前端新手对其了解不是很透彻.时间久了不用,我在写的时候有时也难免对某些操作支支吾吾,记不清楚,现在,对 ...
- lnmp安装
一.准备工作 需要的安装包都是从官网下载的,系统centos6.6 nginx-1.10.1.tar.gz php-5.6.24.tar.gz mysql-5.5.32.tar.gz 所有的包都一传入 ...