When using bundle fallbacks in MVC, I notice that when the cdn fails, the fallback bundle does not have a version string attached to it. Is there a way to force the version string to appear?
My concern is that if I move to a newer version of jQuery (or bootstrap or whatever) that the script will not be updated on the client as it could still be in the cache (since by default the cache length is 1 year).
For example, this bundle config:
Public Module BundleConfig
Public Sub RegisterBundles(ByVal bundles As BundleCollection)
BundleTable.EnableOptimizations = True
bundles.UseCdn = True
Dim jQuery2 = New ScriptBundle("~/bundles/jQuery2", "//broken.ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js") _
.Include("~/Scripts/jquery-2.1.4.min.js")
jQuery2.CdnFallbackExpression = "window.jQuery"
bundles.Add(jQuery2)
End Sub
End Module
embedded with this call:
@Scripts.Render("~/bundles/jQuery2")
produces this output:
<script src="//broken.ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
(window.jQuery)||document.write('<script src="/bundles/jQuery2"><\/script>');
</script>
<script src="/bundles/jQuery2"></script>
Is this a bug, an oversight, or am I missing something to get the version string to appear?
I would expect the fallback bundle to render as:
<script src="/bundles/jQuery2?v=somejunkuniquetothisversionofthefile"></script>
How can I achieve this?
I am aware that this question has been asked before, but the author hasn't updated his question to include any code, so I am doing so here.