I have this:
bundles.Add(new StyleBundle("~/Content/Styles/Default").Include("~/Content/Styles/Default/Site.css"));
And it creates this:
<link href="/Content/Styles/Default?v=HG5hShy6_NaqI7SUDWQuc6zijexRxZooKF4ayIgK5tY1" rel="stylesheet">
Now, i enabled directory browsing on my webserver, and when I click that style path, it moves me to a directory, and not to a file! Why?
Update: I still did not manage to solve that question, all i get when i go on the link http://myserver/Content/Styles/Default?v=HG5hShy6_NaqI7SUDWQuc6zijexRxZooKF4ayIgK5tY1
is a list of files (like on a ftp)
First take a look at this article
Bundling is a new feature in ASP.NET 4.5 that makes it easy to combine
or bundle multiple files into a single file. You can create CSS,
JavaScript and other bundles. Fewer files means fewer HTTP requests
and that can improve first page load performance.
The request
http://localhost/MvcBM_time/bundles/AllMyScripts?v=r0sLDicvP58AIXN_mc3QdyVvVj5euZNzdsa2N1PKvb81
is for the bundle AllMyScripts and contains a query string pair
v=r0sLDicvP58AIXN_mc3QdyVvVj5euZNzdsa2N1PKvb81.
The query string v has
a value token that is a unique identifier used for caching. As long as
the bundle doesn't change, the ASP.NET application will request the
AllMyScripts bundle using this token. If any file in the bundle
changes, the ASP.NET optimization framework will generate a new token,
guaranteeing that browser requests for the bundle will get the latest
bundle
This is how to add directory with files
bundles.Add(new StyleBundle("~/jQueryUI/themes/baseAll")
.IncludeDirectory("~/Content/themes/base", "*.css"));
This is how to add multiple files:
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
"~/Content/themes/base/jquery.ui.core.css",
"~/Content/themes/base/jquery.ui.resizable.css",
"~/Content/themes/base/jquery.ui.selectable.css",
"~/Content/themes/base/jquery.ui.accordion.css",
"~/Content/themes/base/jquery.ui.autocomplete.css",
"~/Content/themes/base/jquery.ui.button.css",
"~/Content/themes/base/jquery.ui.dialog.css",
"~/Content/themes/base/jquery.ui.slider.css",
"~/Content/themes/base/jquery.ui.tabs.css",
"~/Content/themes/base/jquery.ui.datepicker.css",
"~/Content/themes/base/jquery.ui.progressbar.css",
"~/Content/themes/base/jquery.ui.theme.css"));
This is an old question, but Google pointed me here when I was searching for a solution so I thought I would add what worked for me.
I had the same problem as you and ran across this other question that I believe is the same:
MVC4 - Bundling does not work when optimizations are set to true
I imagine the problem is you putting the bundle at a virtual URL that actually exists, but is a directory.
Changing the bundle path fixed the problem I was having.