Bundling fails in release mode

Learned something about bundling the hard way. Deployed a website and now the styling is all wrong? Getting 404 on your bundles? Only getting this on Release “builds”? Maybe you made the same error as we did.

In debug mode the bundles are rendered as individual script / link tags, but in release mode this is optimized in one virtual link. Make sure the bundle is not pointing to an existing file and is linking to a file. Our solution used links without extension and that threw IIS off.

bundles.Add(
/* wrong: new ScriptBundle("~/bundles/kendo") */
/*                       missing extension ^  */
   new ScriptBundle("~/bundles/kendo.js")
      .Include("~/Scripts/kendo/kendo.web.*", 
               "~/Scripts/kendo/kendo.aspnetmvc.*")
);

References

Unknown's avatar

About erictummers

Working in a DevOps team is the best thing that happened to me. I like challenges and sharing the solutions with others. On my blog I’ll mostly post about my work, but expect an occasional home project, productivity tip and tooling review.
This entry was posted in Development and tagged , . Bookmark the permalink.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.