ASP.NET MVC: Bundle not rendering

Today I came across a strange issue in my ASP.NET MVC project. The js script and css style bundles were not rendering. I tried removing the files in the bin and the obj folders, but the problem still continued.

On searching the web, some forums suggested to use bundles.IgnoreList.Clear() in the BundleConfig class. I tried it and the css and js files rendered properly. Below is the screen shot of my BundleConfig class after adding bundles.IgnoreList.Clear(). I’m not sure on the reason behind this, but the fix worked.

Using bundles.IgnoreList.Clear()


UPDATE (26th Aug 2016):

I’ve figured out the reason, why the bundles were not rendering for me before using bundles.IgnoreList.Clear().

It’s because I was using a .min.css file in the bundle. If you notice the above image, I’ve added foundation.min.css file. MVC 4 and above has .min in the default ignore list. That’s the reason the bundle was not rendering in the first place. After adding bundles.IgnoreList.Clear() the default MVC ignore list got cleared and the .min extension file started rendering. Clearing the ignore list is not the correct way of using the bungle. It will be always good not to include .min extension files in the bundle as bundling process will take care of the minification of the js or css file.

Related Articles & Tools

5 comments for “ASP.NET MVC: Bundle not rendering

  1. Jayawant Patill
    Mar 16, 2017 at 3:35 pm

    worked man…thanx a lot.

  2. Sagar rana
    Mar 12, 2015 at 11:57 pm

    Thanks ….worked…looks like MVC 4 issue

  3. Hasthi
    Feb 26, 2015 at 6:17 pm

    Thank you very much..woks for myself as well

  4. Wesley
    Jan 17, 2015 at 7:52 am

    Thank you! It works for me too.

  5. Nov 11, 2014 at 5:41 pm

    thanks this work for me (y)

Leave your thoughts...