View Single Post
  #2 (permalink)  
Old February 17th, 2014, 05:19 PM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 71,384, Level: 100
Points: 71,384, Level: 100 Points: 71,384, Level: 100 Points: 71,384, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,980
Thanks: 79
Thanked 1,564 Times in 1,541 Posts

Hi Alan,

Here's what I have on bundling in the upcoming update for ASP.NET 4.5.1:

1. Run the following package command:

Install-Package Microsoft.AspNet.Web.Optimization.WebForms
2. Open up your Global.asax file and at the top of the file, below the Import statement for the System.Net.Mail namespace, add the following Import statement:

<%@ Import Namespace="System.Web.Optimization" %>
3. In the Application_Start event handler in the same file, add the following code below the line that creates the ScriptResourceDefinition.

BundleTable.Bundles.Add(New StyleBundle("~/StyleSheets").
IncludeDirectory("~/Styles", "*.css"))
BundleTable.Bundles.Add(new StyleBundle("~/StyleSheets").
IncludeDirectory("~/Styles", "*.css"));
4. Open the Frontend master page and right before the closing <head> tag add the following code:
<webopt:bundlereference runat="server" path="~/StyleSheets" />
Hope this works for you too.


Imar Spaanjaars
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote