I am trying out ASP.NET Bundling with ASP.NET MVC 4 application. The situation is that I want to make a CDN style service, which has JS and CSS files to which you can address from other sites with this type address: http://www.mycdn.com/scripts/plugin/js, which bundles and minifies all included .js files.
My bundle config for one file looks like this:
bundles.Add(new ScriptBundle("~/Scripts/plugin/pluginjs").Include("~/Scripts/plugin/jquery.plugin.js"));
However, when I do this, the bundles are not getting updated even after I change the original js files. I keep on getting 304 Not Modified, when I refresh my browser, and the content of the minified file is not updated. How can I make bundles update, because it is useless to have bundles with old content? I tried out every way, but could not figure out a solution.
Thanks in advance!
I just had the exact same problem. I have a folder with 2 CSS files:
My bundling code is this:
bundles.Add(new StyleBundle("~/css/main").Include("~/content/main.css"));
No matter how much I changed my main.css
the output was the same url with the same contents:
<link href="/css/main?v=6Xf_QaUMSlzHbXralZP7Msq1EiLTd7g1vId6Vcy8NJM1" rel="stylesheet"/>
The only way to update the bundle was to rebuild my solution - obviously not the best approach.
However as soon as I deleted main.min.css
, everything started to work just fine. Playing a little more I discovered that if there are both main.css
and main.min.css
, then updating main.min.css
will actually update the bundle... Weirdness, but at least predictable.