I started a project with the "Web API" template in Visual Studio. However, the project started to grow and I needed to raise a web site. When running locally, all the functions are correct, but as soon as I publish the site in Azure, the CSS styles are not recognized.
Here is my Bootstrap directory:
And here is the code for my Bundle class:
public static class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/Content/Scripts/jquery").Include(
"~/Content/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/Content/Scripts/modernizr").Include(
"~/Content/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/Content/Scripts/bootstrap").Include(
"~/Content/Scripts/bootstrap.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/css/bootstrap.css",
"~/Content/css/site.css"));
}
}
The primary layout is the following:
<!DOCTYPE html>
<html>
<head>
...
@Styles.Render("~/Content/css")
@Scripts.Render("~/Content/Scripts/modernizr")
</head>
<body>
<div class="container-fluid">
...
@RenderBody()
...
</div>
@Scripts.Render("~/Content/Scripts/jquery")
@Scripts.Render("~/Content/Scripts/bootstrap")
<script src="~/Content/CustomScripts/Global.js"></script>
@RenderSection("scripts", required: false)
</body>
</html>
The following similar question (link1 y link2) mention that it is necessary to change the Bundle archive name, but it doesn't work when I publish to Azure; however, as previously mentioned, it works correctly locally.