Bundle.IncludeDirectory in MVC5 outputting invalid paths

I upgraded the MVC 4 project to MVC 5 as part of the upgrade to VS2013 and I get weird behavior with Bundles and Minification. Then I tried in a new MVC 5 project and also had the same problem. This is what I do:

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 opinion:

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

Now, when I view the page using Bundling and Minification Off, this is what is displayed:

 <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> 

Please note that all files are in /app , and subdirectories are lost in the process.

I used this for a long time in the MVC 4 project without any problems.

The Microsoft.AspNet.Web.Optimization package is 1.1.1.

Has anyone experienced this?

+7
asp.net-mvc asp.net-mvc-5 bundling-and-minification
source share
1 answer

I should have looked better. This is a known issue.

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

+6
source share

All Articles