背景:我正在迁移一个 ASP.NET
MVC 5
应用程序(在 Windows 8.1、VS2013
中开发社区、.NET 4.5.1
、MySql
自定义成员资格和 Angular 色提供者)元素到 Monodelop
(在 Ubuntu 14.4
中, Monodelop
, Mono
).
在我的 ~/App_Start/BundleConfig
类中
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-*"));
}
在我的 ~/Views/Shared/_Layout.cshtml
View 中
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
在我的Web.Config
<add namespace="System.Web.Optimization" />
还有
<compilation defaultLanguage="C#" debug="false"> </compilation>
Microsoft.Web.Infrastructure.dll
也从 bin 目录中删除。
问题:当我在浏览器中查看源代码时,我没有看到包正在呈现:
链接指向目录,应该显示目录中的文件
<link href="/Content/css" rel="stylesheet"/>
<script src="/bundles/modernizr"></script>
此捆绑在 Windows 上运行良好,但在 Ubuntu 上,我只能看到目录
我在这里做错了什么?
最佳答案
在您的 BundleConfig 文件中添加以下内容:
BundleTable.EnableOptimizations = true;
然后切换到 Release模式。
这应该可以解决问题
关于javascript - 样式表和脚本包在 Mono 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30498579/