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的原因和解决方法
补充:正常情况下,建议数据库备份最好用工具进行备份,通过拷贝数据库表进行数据迁移,不同的环境会出现各种不同的意外问题. 背景:今天在整理一个网站的时候,操作系统由于系统自动更新导致一直出现系统蓝屏死机 ...
随机推荐
- 创建table并实现ID自增长
① create table p_user( id number(10) not null primary key, name varchar2(3 ...
- angularJS select
ng-options指令 在angularJS中创建select下拉是使用ng-options创建下拉项 ng-options="val as label for element in ar ...
- Python全栈开发【基础三】
Python全栈开发[基础三] 本节内容: 函数(全局与局部变量) 递归 内置函数 函数 一.定义和使用 函数最重要的是减少代码的重用性和增强代码可读性 def 函数名(参数): ... 函数体 . ...
- apple常用网址
https://developer.apple.com/ https://itunesconnect.apple.com/ iTunes Connect Developer Guide https:/ ...
- Nodejs 的 Express框架 学习体会 补充中。。。
最近为了用Shadow Socket FQ,到https://bandwagonhost.com上买了一个便宜的vps,19.99美元一年.服务器闲着也是闲着,就想搭建一个简单的博客. Express ...
- 第20讲 HOOK和数据库编程
1,安装钩子过程可以通过SetWindowsHookEx函数来完成 2,得到当前线程ID,可以用GetCurrentThreadId 3,移除钩子可以用UnhookWindowsHookEx函数 4, ...
- tp5 中 model 的获取器
在获取数据的字段值后自动进行处理 // 模型中写入如下代码,则查询结果会自动将status的结果进行转换 class User extends Model { public function getS ...
- 导入excel
1.js使用ajaxfileupload.js实现文件上传 2.将文件转为字节 3.将字节转为excel保存到服务器 4.根据路径读取excel文件并转为dataSet 5.将dataSet写入数据库
- iOS10 远程推送服务器所需证书以及应用授权文件配置
推送证书制作步骤(目的:导出服务器需要的p12证书) 第一步: 打开Mac系统的"钥匙串访问"-"证书助理"-"从证书颁发机构请求证书" 取 ...
- doT.js学习
doT.js特点是快,小,无依赖其他插件.但是一般和jquery一起使用 官网:http://olado.github.io 使用方法:{{= }} for interpolation{{ }} fo ...