Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bundle.IncludeDirectory in MVC5 outputting wrong paths

I upgraded an MVC 4 project to MVC 5 as part of the upgrade to VS2013 and I'm getting a strange behaviour with Bundles and Minification. I then tried in a new MVC 5 project and also have the same issue. This is what I'm doing:

Start with a new MVC 5 project and add the following files

app\0.js
app\a
app\a\b
app\a\c
app\a\b\1.js
app\a\c\6.js
app\a\c\d
app\a\c\e
app\a\c\d\2.js
app\a\c\d\3.js
app\a\c\d\4.js
app\a\c\e\5.js

Then in my BundleConfig I add

bundles.Add(new ScriptBundle("~/bundles/app")
    .IncludeDirectory("~/app", "*.js", true));

And in my view:

@Scripts.Render("~/bundles/app")

Now when I browse to the page with Bundling and Minification Off, this is what's rendered:

<script src="/app/0.js"></script>
<script src="/app/1.js"></script>
<script src="/app/6.js"></script>
<script src="/app/2.js"></script>
<script src="/app/3.js"></script>
<script src="/app/4.js"></script>
<script src="/app/5.js"></script>

Note that all files are at /app and the subdirectories got lost in the process.

I've been using this for a long time in an MVC 4 project without any problems.

Microsoft.AspNet.Web.Optimization package is 1.1.1.

Does anyone experienced this?

like image 858
Pedro Avatar asked Oct 22 '13 20:10

Pedro


1 Answers

I should have searched better. It's a known issue.

http://aspnetoptimization.codeplex.com/workitem/105

like image 190
Pedro Avatar answered Oct 09 '22 11:10

Pedro