I am having a problem with script bundling and minification with ASP .NET I have tried all popular solution found on internet but still having the same problem.
My <
Have you tried using non existing directory in Bundle's virtual path? Like
...new ScriptBundle("~/bundle/Scripts")...
The bundle module logic that decides whether or not to handle a request, will not takeover requests to existing files or directories. So that's why your bundle requests don't work when they live at the same virtual path as an existing directory (or file).
You can't give your bundle a name that is also the name of an existing directory. Rename the bundle or add a /js
to make it work correctly:
bundles.Add(new ScriptBundle("~/Scripts/js").IncludeDirectory("~/Scripts", "*.js").IncludeDirectory("~/Scripts/kendoui", "*.js"));
and
@Scripts.Render("~/Scripts/js")
Any other name that doesn't exist would work as well, e.g.
bundles.Add(new ScriptBundle("~/ScriptMonkey").IncludeDirectory("~/Scripts", "*.js").IncludeDirectory("~/Scripts/kendoui", "*.js"));
...assuming you don't have /ScriptMonkey
directory.
The accepted answer did not work for me. I use MVC 4.0 on Visual Studio 2010 SP1. I had a js file named "jquery-ui.min.js" file and was not getting loaded. My Bundle.config code was:
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui.min.js"));
I renamed the file to jquery-ui.js and updated my code as
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui.js"));
I got this information from here.