MonoDevelop 4: CSS files not loading for an ASP.NET MVC4 site

Posted on 3 Comments
MonoDevelop 4
MonoDevelop 4

If you are like me — always living in Linux, but sometimes being required to develop ASP.NET sites — you have no doubt used MonoDevelop. While its latest iteration brings in many good things, it’s still not the ready-to-use Visual Studio.

Once you are past the System.UnauthorizedAccessException and Could not load file or assembly ‘System.Web.WebPages’ errors, you might encounter another weirdo in an imported MVC4 site, an error that prevents loading of default stylesheet(s) in browser. As a result, your site may look completely deprived of any styles, colors, images, etc.

The origin of this error lies in the simple fact that while Windows (possibly the source of your imported MVC site) is case-insensitive with file names, Linux isn’t. Correcting this is as simple as:

  1. opening the file App_Start > BundleConfig.cs, and
  2. changing
  3. bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));

    to

    bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/Site.css"));

  4. that is: site.css to Site.css

Merry coding!

3 thoughts on “MonoDevelop 4: CSS files not loading for an ASP.NET MVC4 site

  1. Brilliant!

  2. It’s imperative that more people make this exact point.

  3. That’s really thinking at an impressive level

Leave a Reply

Your email address will not be published. Required fields are marked *

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