4

I have developed a website on MVC5 and deployed it to Azure websites. The site works as expected but on browsing to the website hosted in Azure, the site ignores the changes I have made to the default bootstrap.css file. This file is set as "Copy Always" to the output directory, so it is present in Azure as well with the rest of the code.

Refreshing the browser does not show the website as it should be displayed. Neither does restarting the azure website help. Below is my code:

Site.master

<head runat="server">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />       
<title>Title</title>

<asp:PlaceHolder runat="server">
    <%: Scripts.Render("~/bundles/modernizr") %>
</asp:PlaceHolder>
<webopt:bundlereference runat="server" path="~/Content/css" />        
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />

</head>
<body>
*Rest of default Site.Master file*

Bundle.config

<bundles version="1.0">
    <styleBundle path="~/Content/css">
        <include path="~/Content/bootstrap.css" />
        <include path="~/Content/Site.css" />
    </styleBundle>
</bundles>
Luis Delgado
  • 3,644
  • 4
  • 34
  • 54
  • As mentioned in my other answer here: http://stackoverflow.com/questions/19664287/bootstrap-icons-are-loaded-locally-but-not-when-online, most likely it is the name of the bundle which is causing the problem. Please try changing the name of the bundle from `~/Content/css` to something else like `~/Content/bootstrapcss` and see if that solves the problem. – Gaurav Mantri Dec 27 '13 at 03:46
  • @GauravMantri changing the naming did not resolve the problem, but thanks for suggesting. – Luis Delgado Dec 27 '13 at 13:17

2 Answers2

2

Workaround found

I managed to get the behavior I am expecting by doing the following. Might not be the best approach, but it is functional and I can't see any major flaws on it.

On Site.Master, replace this line:

   <webopt:bundlereference runat="server" path="~/Content/css" />

with these ones:

<link href="~/Content/bootstrap.css" rel="stylesheet" type="text/css" runat="server" />
<link href="~/Content/Site.css" rel="stylesheet" type="text/css" runat="server" />
Luis Delgado
  • 3,644
  • 4
  • 34
  • 54
  • 1
    This answer defeats the purpose of bundling and removes all the benefits bundling provides. Check the response from the website using Fiddler 2 (http://www.telerik.com/fiddler) and see if you are getting a 403 (which would indicate a folder clashes with your bundle name). – iCollect.it Ltd Apr 07 '14 at 11:32
1

If you modified bootstrap.css you need to update the minified version bootstrap.min.css as well.

You can do that easily at: cssminifier.com

For details on how to update the minified version, check out this question

Community
  • 1
  • 1
tzup
  • 3,566
  • 3
  • 26
  • 34
  • Nope that didn't work. Visual Studio doesn't even bother formatting it the same way. It auto-formats to the long version. I also just tried changing the settings manually, nada. No change. All I'm doing is changing the btn-default color. – Nathan McKaskle Jul 25 '17 at 16:09