Background: I am migrating an ASP.NET
MVC 5
application (developed in Windows 8.1, VS2013
Community, .NET 4.5.1
, MySql
custom membership and role provider) project to Monodevelop
(in Ubuntu 14.4
, Monodevelop
, Mono
).
In my ~/App_Start/BundleConfig
class
public static void RegisterBundles(BundleCollection bundles)
{
BundleTable.EnableOptimizations = true;
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
}
In my ~/Views/Shared/_Layout.cshtml
view
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
In my Web.Config
<add namespace="System.Web.Optimization" />
Also
<pilation defaultLanguage="C#" debug="false"> </pilation>
Also Microsoft.Web.Infrastructure.dll
is deleted from the bin directory.
Problem: I don't see that the bundles are getting rendered when I view source in the browser:
The links are directing towards directories, It should show files in the directories
<link href="/Content/css" rel="stylesheet"/>
<script src="/bundles/modernizr"></script>
What am I doing wrong here?
Background: I am migrating an ASP.NET
MVC 5
application (developed in Windows 8.1, VS2013
Community, .NET 4.5.1
, MySql
custom membership and role provider) project to Monodevelop
(in Ubuntu 14.4
, Monodevelop
, Mono
).
In my ~/App_Start/BundleConfig
class
public static void RegisterBundles(BundleCollection bundles)
{
BundleTable.EnableOptimizations = true;
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
}
In my ~/Views/Shared/_Layout.cshtml
view
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
In my Web.Config
<add namespace="System.Web.Optimization" />
Also
<pilation defaultLanguage="C#" debug="false"> </pilation>
Also Microsoft.Web.Infrastructure.dll
is deleted from the bin directory.
Problem: I don't see that the bundles are getting rendered when I view source in the browser:
The links are directing towards directories, It should show files in the directories
<link href="/Content/css" rel="stylesheet"/>
<script src="/bundles/modernizr"></script>
What am I doing wrong here?
<pilation debug="true" />
or BundleTable.EnableOptimizations = false;
?
– rageit
Commented
Jun 17, 2015 at 11:14
BundleTable.EnableOptimizations
in my project. Is it something in web.config or BundleConfig? If yes how can I use it?
– Mr.X
Commented
Jun 22, 2015 at 7:18
Microsoft.Web.Infrastructure.dll
in your bin
directory? If so, try deleting it. Mono has it's own implementation it will use if this file is missing.
– Dave Alperovich
Commented
Jul 15, 2015 at 20:16
Inside your BundleConfig file add the following:
BundleTable.EnableOptimizations = true;
Then switch to release mode.
This should do the trick
I just came across this issue myself today. Mihai-Tibrea 's answer does indeed work, but it leads to unacceptable requirements for my purposes.
If always enabling bundling (BundleTable.EnableOptimizations = true; and/or build in release mode) is not acceptable consider the following:
In BundleConfig.cs find a line like this:
"~/Content/site.css"
Change that to
"~/Content/Site.css"
Note that in mono, the case of file names is very important, while that is not important in windows. So either your html needs to use lower-case site.css OR your bundle needs to start with a capital letter.