Question

I can't seem to get the javascript files to update in VS2013, asp.net using bundles. The image is after I have done a clean/rebuild, bundle clear and resetall, and deleted the browser history in IE (including cookies, website data, temp files and website files.) I have wasted day after day trying to get my site working. I have googled this a hundred times and found no satisfactory answers. What am I missing? There has got to be an easy way to do this.

Outdated javascript file

Was it helpful?

Solution

As I said in the comment, don't use bundles during development of javascript or CSS files at all.

Just comment out the part where the bundle is rendered and include the corresponding files the classic way like this:

<script src="~/Scripts/myscript.js?v=@DateTime.Now.Ticks" type="text/javascript"></script>

When deploying the project remove that line and reactivate the previously commented bundle-rendering call.

Because the uri-parameter version string of the "classic-approach" is changing on each request you can be sure that you always have the latest version of javascript file and are not dependent on some CacheDependency of the Bundle-Framework to trigger or update (which apparently is not working all of the time).

Just don't forget to remove that manual script include so that your users' browsers can actually cache the resources.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top