If you increment the version number as you increment the version, when you roll out code to production, it will jog the cache of users and allow them to have the latest/greatest without being frozen in the past. One way to do this with Razor markup would be like so:
<script src="~/Scripts/Whatever.js?v=@Utilities.RetrieveVersionNumber()"></script>
On the C# side we could have a static method like this:
public static string RetrieveVersionNumber()
{
return System.Reflection.Assembly.GetExecutingAssembly().GetName()
.Version.ToString();
}
If the version seems to come back as 0.0.0.0 all the time, this is probably only happening in your local environment. The 0.0.0.0 should be replaced with a real number when you view the deployment to production's HTML.
No comments:
Post a Comment