Bundling Not Working when deployed

If you deploy an MVC site to a server that DOESN’T have the full MVC package installed (e.g. you just want to copy the binaries with your site) then bundling will not work correctly.

To expand on this the page simply will not render the css or scripts but if you look at the source HTML the actual bundled scripts are written correctly – it’s as if the actual ‘files’ they relate to don’t actually exist.

This fix is to simply ensure the system.web.optimisation.dll has copied to your site bin folder and then add the following to your web.config:


<remove name=”BundleModule” />

<add name=”BundleModule” type=”System.Web.Optimization.BundleModule” />