I am deploying a new website as my main site and it works beautifully.
All of my applications under the root url work as well, except for one. It is a legacy system (c#
In Visual Studio .. Go to your project and see the References tree.
right click System.Web.Optimization and choose Properties
look for the path
, you will find it empty
if that is the case then
look in your PC for the file names System.Web.Optimization.dll and copy it in the bin
folder of your project and that will resolve it
Check the Bin
folder for the legacy application. It may simply need you to drop in that DLL. The System.Web.Optimization
namespace exists as of ASP.NET 4.5 so it may not even be supported. The legacy App might be older than that.
I faced same problem after create a new area in MVC5. There is auto generate web.config file. Check your web.config file under Views folder there is a line
<add namespace="System.Web.Optimization" />
if you need this then install it using following command.
Install-Package Microsoft.AspNet.Web.Optimization
at Package Manager Console like below
If you think no need then simply remove <add namespace="System.Web.Optimization" />
line from following section in web.config file
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<!--<add namespace="System.Web.Optimization" />-->
<add namespace="AutoParts.Web" />
</namespaces>
Removing the reference from Views/Web.config worked for me.
I was just experiencing: "CS0234 C# The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)" and found this stackoverflow page. -- The cause for me was due to me renaming the web form (aspx page) I was working with, I also wanted to rename the public partial class behind that form. Doing so resulted in the mentioned error code. I added "using System.Web.Optimization;
" to the code behind (C#), "cleaned" the solution, then "built" then solution, then "rebuilt" the solution and now the error is gone and that using statement wasn't being used, so I got rid of it. My solution no longer has that or any errors so I figured I'd share this weird story. I probably didn't need to use that "using
" statement, but whatever.
Main to Area
@Html.ActionLink("My Area Home", "Index", "Home", new { area = "MyArea" }, null)
Area to Main
@Html.ActionLink("Home", "Index", "Home", new { area = "" }, null)