ASP.Net MVC 5子目录捆绑问题

mit*_*daa 9 c# asp.net-mvc bundling-and-minification

我在ASP.Net MVC 5项目中看到了捆绑的奇怪行为.当我在BundleConfig.cs文件中显式声明所有文件时,我的项目工作得很好,如下所示:

bundles.Add(new ScriptBundle("~/bundles/app").Include(
                "~/app/app.js",
                "~/app/config.js",
                "~/app/dir1/file1.js",
                "~/app/dir1/subdir1/file2.js",
                .....
Run Code Online (Sandbox Code Playgroud)

但是,如果我转而使用IncludeDirectory,则开发(BundleTable.EnableOptimizations = false)期间的脚本路径不完整.这就是我所看到的:

bundles.Add(new ScriptBundle("~/bundles/app").Include(
                "~/app/app.js",
                "~/app/config.js")
                .IncludeDirectory("~/app/dir1", "*.js", true)
Run Code Online (Sandbox Code Playgroud)

当Chrome试图获取时,Chrome会向我显示404 file2.js.捆绑系统将以下内容添加到我的布局页面:

<script src="/app/app.js"></script>
<script src="/app/config.js"></script>
<script src="/app/dir1/file1.js"></script>
<script src="/app/dir1/file2.js"></script>
Run Code Online (Sandbox Code Playgroud)

通往file2.js错误的道路.它省略subdir1了路径的一部分.我在这里错过了什么吗?

Jos*_*osh 12

这是版本1.1.1的已知问题.升级包(或降级到1.1.0),它应该解决您的问题.

在调试模式下Web优化路径问题