I'm trying to implement bundling in Sitecore 8.2 and followed all the steps in this document.

The breakpoint is hit for the RegisterBundles method, but the assets are not rendered on page.

In the layout, it only renders this:

<link href="/bundles/css?v=" rel="stylesheet"/>

The processor specified in the document did not work for me. The breakpoint wasn't being hit. I changed it to this:


<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
         <processor patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.ShowVersion, Sitecore.Kernel']"
            type="MyProject.Web.Pipelines.RegisterPlatformBundles, MyProject" />


private void RegisterBundles(BundleCollection bundles)
            /// Bundled CSS 
            bundles.Add(new StyleBundle("~/bundles/css").Include(



@Mahendra's suggestion worked for me. I removed the versions from the css references.
Also, to fix the incorrect image/font paths, I changed the RegisterBundles method to this:

private void RegisterBundles(BundleCollection bundles)
   /// Bundled CSS 
   bundles.Add(new StyleBundle("~/bundles/css")
            .Include("~/Assets/css/main.css", new CssRewriteUrlTransform())
            .Include("~/Assets/css/dev.css", new CssRewriteUrlTransform()));            
  • 1
    did you try by adding ~ i.e ~/bundles/css? also, try by removing the query from the include section Commented Jan 28, 2020 at 14:51
  • @MahendraShekhawat. In the Layout.cshtml, that is how I added. Are you referring to something else?
    – sukesh
    Commented Jan 28, 2020 at 14:54
  • Sorry for the confusion here, I mean here is ~//, a double slash in layout. are you getting any 404 error for the link? try to open <link href="/bundles/css?v=" rel="stylesheet"/> (href) in new tab Commented Jan 28, 2020 at 15:00
  • Removing the version worked. It now loads as <link href="/bundles/css?v=blNztwxsF5QM3OLfN6fFdLya8YpG5qMfrbHhfcIUFP81" rel="stylesheet"/>. But how do I add the versions for a particular file here.
    – sukesh
    Commented Jan 28, 2020 at 15:04
  • glad it works, StyleBundle class required a physical file and do not accept any query string. updated the same in the answer. Commented Jan 28, 2020 at 16:42

2 Answers 2


I just had this happen, the issue is that Sitecore is picking on the bundling URL. Need to add your /bundles/css to the IgnoreUrlPrefixes setting

<setting name="IgnoreUrlPrefixes" value="/sitecore/default.aspx|/trace.axd|/webresource.axd|/sitecore/shell/Controls/Rich Text Editor/Telerik.Web.UI.DialogHandler.aspx|/sitecore/shell/applications/content manager/telerik.web.ui.dialoghandler.aspx|/sitecore/shell/Controls/Rich Text Editor/Telerik.Web.UI.SpellCheckHandler.axd|/Telerik.Web.UI.WebResource.axd|/sitecore/admin/upgrade/|/layouts/testing|/sitecore/service/xdb/disabled.aspx?|/bundles/css" />

ASP.NET MVC API includes StyleBundle class that does CSS minification and bundling. If it is not working, then there a few things which we need to check -

  • Make sure all files exists as a physical file, a virtual path will not work since it is not created yet
  • Styles.Render have a proper path in the layout
  • Make sure render link (virtual path) is not throwing any error, if it is then there may be some error in code.
  • Remove any version query from the file path

you can easily check the all included files by enabling and disabling the Bundling and minification by setting the value of the debug attribute debug="true" in the compilation element in the Web.config file.

  • Please advice how to add a version to a particular file (either css/jss)
    – sukesh
    Commented Jan 29, 2020 at 5:00
  • ?v=* is used to makes sure you are getting the latest version of the CSS or js file from the server in a link tag and not a cached copy. Since StyleBundle runs server-side and includes files as physical locations, you can't get a file with a version by the query string. All you need to add the version in the file name such as "main_202001236.css". Commented Jan 29, 2020 at 7:44
  • Where to add ?v=* is unclear. Main_2020.css will make the server look for a file with that name. right, whereas the file present is main.css. Could you please clearly how to add a particular file with the latest version.
    – sukesh
    Commented Jan 29, 2020 at 7:52
  • ?v=* will only work in <link> tag. yes, the server will look for the file name. now if the main.css file is there then it will be only and latest file there because OS will not allow the multiple files with the same name. Commented Jan 29, 2020 at 8:07
  • Your suggestion did not work. The actual file name is main.css. In the method, i changed it to main_2020.css & now it doesn't load. Is that what you suggested.
    – sukesh
    Commented Jan 29, 2020 at 8:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.