0

I m currently having a project which was written by classical asp.net web forms. Now i do not want to convert all the project to mvc 4.0. thats why i m trying to make my project to hybrid project. i added all mvc, routing libraries.

but i can not add system.web.optimization to my project. and in auto generated code i m getting error.

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.17929
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace ASP {
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Helpers;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Optimization; // the line i m getting error
using System.Web.Routing;


public class _Page_Views_Home_Contact_cshtml : System.Web.Mvc.WebViewPage<dynamic> {


    public _Page_Views_Home_Contact_cshtml() {

....

1
  • " i m getting error." - those things usually contain useful information - even if you can't understand it, others may - so care to add the details? Also, just to check, you are aware of the difference between references and using directives, aren't you? Commented Jul 17, 2013 at 7:04

1 Answer 1

3

It's obsolete in ASP.NET MVC 4

You can get what you need from nuget:

Install-Package Microsoft.AspNet.Web.Optimization

SOURCE

Additional help:
Adding the new ASP.NET Web Optimization framework to MVC4 projects after manually upgrading them

Sign up to request clarification or add additional context in comments.

1 Comment

Just for clarity, for those who are migrating legacy websites to the latest VS, after adding Microsoft.AspNet.Web.Optimization package, you would then invoke the BundleTable, StyleBundle and ScriptBundle classes by using the full path of System.Web.Optimization.xxxxx ("xxxxx" being BundleTable, etc..).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.