2

I'm following guidance from the below link to create a javascript bundle in a VS2010 webforms website.

http://igorzelmanovich.blogspot.co.uk/2012/09/using-aspnet-bundling-and-minification.html

I've got this in my global.asax:

void Application_Start(object sender, EventArgs e) 
{
    // Code that runs on application startup

    System.Web.Optimization.BundleTable.Bundles.Add(new System.Web.Optimization.ScriptBundle("~/bundles/js").Include("~/scripts/jquery.bxSlider.js"));

}

and this in my sitemaster (note I havent moved my main jquery source to the bundle just yet)

 <script type="text/javascript" language="javascript" src="scripts/jquery-1.8.2.min.js"></script>

<%: System.Web.Optimization.Scripts.Render("~/bundles/js")  %>

I've installed the Microsoft.AspNet.Web.Optimization package from Nuget and its got all the binaries and the website builds successfully. I've tried setting the web.config debug value to true and false, yet the bundles/js folder does not generate with a bundle containing jquery.bxSlider.js, i've created the bundles/js folder manually but still no luck.

When debugging the Application_Start does get called, just doesn't generate anything.

User101
  • 748
  • 2
  • 10
  • 29

1 Answers1

0

Do you get something like this?

enter image description here

or is it empty? for example: <script src="/bundle/js"></script>

Carlos Martinez T
  • 6,458
  • 1
  • 34
  • 40
  • Hi @carlos, its empty, i.e there is nothing rendered there at all, not even a script tag – User101 Oct 22 '12 at 14:37
  • That's weird. It should write something event if the url doesn't exist in the BundleTable. What about changing it to: `<%= System.Web.Optimization.Scripts.Render("~/bundles/js") %>` or try with `<%= System.Web.Optimization.Scripts.Url("~/bundles/js") %>` – Carlos Martinez T Oct 22 '12 at 14:52
  • Tried with an <%= and the other one, no luck :( – User101 Oct 22 '12 at 14:56
  • @CarlosMartinez I get the generated script with src like you mentioned, however the actual file does not exist, any ideas why? – mrd3650 Aug 11 '15 at 15:46