如何解决错误“CS0234:名称空间'System.Web'中不存在类型或命名空间名称'优化'(您是否缺少程序集引用?)" [英] How to resolve error "CS0234: The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)"
本文介绍了如何解决错误“CS0234:名称空间'System.Web'中不存在类型或命名空间名称'优化'(您是否缺少程序集引用?)"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在VS 2012中创建了asp .net web表单应用程序并运行default.aspx页面。
我遇到了运行时错误
I have created asp .net web form application in VS 2012 and run the default.aspx page.
I got following runtime error
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0234: The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Source Error:
Line 17: <pages>
Line 18: <namespaces>
Line 19: <add namespace="System.Web.Optimization" />
Line 20: </namespaces>
Line 21: <controls>
Source File: .../WebApp2/Web.config Line: 19
Show Detailed Compiler Output:
Show Complete Compilation Source:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
按照go搜索这个错误的解决方案,我试图通过复制System.Web来解决.Optimization.dll从包文件夹到bin文件夹但问题未解决。
请给出解决方案。
As per show solution by googling this error, I have tried to resolved by copy System.Web.Optimization.dll from package folder to bin folder but issue not resolved.
Please give the solution.
推荐答案
尝试通过nuget安装Microsoft.AspNet.Web.Optimization(因为它没有被框架安装) )。
在nuget提示符下尝试install-package Microsoft.AspNet.Web.Optimization
。
Try installing Microsoft.AspNet.Web.Optimization via nuget (as it is not installed by the framework).
Tryinstall-package Microsoft.AspNet.Web.Optimization
in the nuget prompt.
这篇关于如何解决错误“CS0234:名称空间'System.Web'中不存在类型或命名空间名称'优化'(您是否缺少程序集引用?)"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文