Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have created asp .net web form application in VS 2012 and run the default.aspx page.
I got following runtime error

XML
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


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.
Posted
Updated 19-Jul-15 21:09pm
v3
Comments
F-ES Sitecore 1-Jul-15 4:59am    
Have you added a reference to the optimisation assembly in your project?
Makarand Borawake 1-Jul-15 5:00am    
Yes I have added reference.

1 solution

Try installing Microsoft.AspNet.Web.Optimization via nuget (as it is not installed by the framework).
Try install-package Microsoft.AspNet.Web.Optimization in the nuget prompt.
 
Share this answer
 
Comments
Makarand Borawake 1-Jul-15 5:16am    
Thanks!!
I tried above solution, but gave same error.
Stevey T 23-Jul-20 13:14pm    
So I am having the same similar issue. I cloned my tfs project and ran it locally and it gives Me the same error/issue. Originally I wrote created my project locally and then placed it in a tfs project. It worked locally but now that I am using tfs its giving namespace errors for Optimization, BundleCollection, ASPNet,ScriptBundle and so on. How do I resolve this issue?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900