Search code examples
asp.net-mvctwitter-bootstrapasp.net-mvc-4bundling-and-minification

ASP.NET MVC Bundling wrong Bootstrap version


I have an issue where the Bundling in MVC4 in production is somehow bundling an older version of Bootstrap that I no-longer have in my project.

I updated the version of Bootstrap as I wanted to use some Glyphicons that the old version in my project didn't support.

Running locally in debug or release mode, all of the Glyphicons show as expected, but once deployed to production (using msbuild to deploye to Azure Web App), the newer Glyphicons are missing, and the minified+bundled css file is missing references to the newer Gyphicons - it's essentially an older version of bootstrap.css

This is my RegisterBundles method:

    public static void RegisterBundles(BundleCollection bundles)
    {
        bundles.UseCdn = false;

        // Clear out the list and add back the ones we want to ignore.
        // Don't add back .debug.js.
        bundles.IgnoreList.Clear();
        bundles.IgnoreList.Ignore("*-vsdoc.js");
        bundles.IgnoreList.Ignore("*intellisense.js");

        bundles.Add(new StyleBundle("~/style/global").Include(
            "~/Content/css/lib/bootstrap.css",
            "~/Content/css/global.css"));
    }

Then I'm using...

@Styles.Render("~/style/global")

To include the styles.


Solution

  • Use the ResetAll() method to clear and reset. More about it here.