The name 'Scripts' does not exist in the current context error in MVC
2014-03-31 10:51
411 查看
创建完成ASP.NET MVC4应用程序以后,试着运行其中一个Create页面, 程序报出运行是错误:
CS0103: The name 'Scripts' does not exist in the current context
问题根源是Create页面是MVC自动创建的, 在自动创建时添加了一段代码:
解决方法:
在VS中打开Package Manager Console
Tools -> Library Package Manager -> Package Manager Console
安装
在Package Manager Console中输入命令并运行
添加对System.Web.Optimization的引用
将<addnamespace="System.Web.Optimization"/>添加到Web.config的命名空间部分。两个web.config中都要添加, 程序根目录中的和Views文件夹中的。
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文件夹中的。
相关文章推荐
- MVC:The name 'Scripts' does not exist in the current context
- Error:The name 'Encoding' does not exist in the current context 解决方法
- The name 'Profile' does not exist in the current context
- CS0103: The name ‘Scripts’ does not exist in the current context解决方法
- InitializeComponent does not exist in the current context
- HttpUtility does not exist in the current context
- Unity 错误(1)——The name `xxx' does not exist in the current context
- The name 'xxx' does not exist in the current context 錯誤解決方法之一
- 如何解决 The name ControlID does not exist in the current context 错误!
- The name ‘InitialzeComponent’ does not exist in the current context
- The name 'Profile' does not exist in the current context
- error CS0103: The name `UnityEditor' does not exist in the current context
- The name does not exist in the current context
- 关于编写WPF UserControl时提示The name 'InitializeComponent' does not exist in the current contextr的解决!
- 解决办法:The name 'Response' does not exist in the current context
- wpf程序报"The name 'InitializeComponent' does not exist in the current context"的
- The name does not exist in the namespace error in XAML
- CS0234 The type or namespace name 'Mvc' does not exist in the namespace 'Microsoft.AspNet' (are you
- About Derby "ERROR 42X51: The class '***' does not exist or is inaccessible. This can hap pen if the class is not public."
- s3cmd在配置后使用时提示ERROR: S3 error: 403 (InvalidAccessKeyId): The AWS Access Key Id you provided does not exist in our records.