Unable to get Bundling/Minification to work in VS2012

visual-studio

Solution

First create your script bundle, and add whichever scripts you want.

public static void RegisterBundles(BundleCollection bundles)
{
    bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
        "~/Scripts/jquery-1.*",
        "~/Scripts/jquery-ui-1.8.20.js"));
}

Then use @Scripts.Render in you page like this:

@Scripts.Render("~/bundles/jquery");

Notice that the path I specified in the ScriptBundle above is the same path I used in Scripts.Render.

Follow this article, http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification.

Problem

I am using Visual Studio 2012 RC I have created an ASP.NET 4 Web Application / Internet Application In a view I have this code: ``` <script type="text/javascript"> $(function () { alert("Test"); }); </script> ``` In spite of prolonged searching I cannot get Bundling/Minification to work. In _Layout.cshtml I have the following. I have done NOTHING else. Can someone please tell me what I need to do? Many Thanks. ``` @Styles.Render("~/Content/themes/base/css", "~/Content/css") @Scripts.Render("~/bundles/modernizr") @*This line Does Not Work*@ @Scripts.Render("~/Scripts/js") @*This Line Does Work*@ <script type="text/javascript" src="~/Scripts/jquery-1.7.2.js"></script> ```

Original source