How to serve bundles from another application w/ ASP.NET Bundling?

115 Views Asked by At

My solution consists of several WebApplications who share the same static content.

I've been recently been using Microsoft ASP.NET Optimization Framework for bundeling these files.

The problem is I only have one Global.asax file where I register all the bundles, for instance:

var jqueryBundle = new ScriptBundle("~/Scripts/jquery");
        jqueryBundle.Include(new string[] { 
    "~/static/js/jQuery/jquery-1.11.2.js",
    "~/static/js/jQuery/jquery-ui.js"});

Then on my Master page I have :

<asp:PlaceHolder ID="phBundle" runat="server">
    <%: System.Web.Optimization.Scripts.Render("~/Scripts/jquery") %>
</asp:PlaceHolder>

To reference this files on any other aplication I have to use the full path:

<%: System.Web.Optimization.Scripts.Render("/websites/MainApp/Scripts/jquery") %>

The problem with this is that, when running in debug mode, the second application static files appear as bundles and not as single/separated files.

Also, when running in release mode, files are fettched without a hash (meaning if they are cached they won't be updated)

MAIN APP Get static files on the 1st application

SECONDARY APP Get static files on the 2nd application

I want to solve this problem wihtout copying all the static files between every project and registering them individually in the Global.asax (currently only the main app has a Global.asax)

0

There are 0 best solutions below