我通过将最后修改的时间戳作为查询参数添加到脚本中解决了这个问题。  
我使用扩展方法做到了这一点,并在我的 CSHTML 文件中使用它。  注意:此实现将时间戳缓存 1 分钟,因此我们不会对磁盘进行过多的抖动。
下面是扩展方法:
public static class JavascriptExtension {
    public static MvcHtmlString IncludeVersionedJs(this HtmlHelper helper, string filename) {
        string version = GetVersion(helper, filename);
        return MvcHtmlString.Create("<script type='text/javascript' src='" + filename + version + "'></script>");
    }
    private static string GetVersion(this HtmlHelper helper, string filename)
    {
        var context = helper.ViewContext.RequestContext.HttpContext;
        if (context.Cache[filename] == null)
        {
            var physicalPath = context.Server.MapPath(filename);
            var version = $"?v={new System.IO.FileInfo(physicalPath).LastWriteTime.ToString("MMddHHmmss")}";
            context.Cache.Add(filename, version, null,
              DateTime.Now.AddMinutes(5), TimeSpan.Zero,
              CacheItemPriority.Normal, null);
            return version;
        }
        else
        {
            return context.Cache[filename] as string;
        }
    }
}
然后在 CSHTML 页面中:
 @Html.IncludeVersionedJs("/MyJavascriptFile.js")
在呈现的 HTML 中,这显示为:
 <script type='text/javascript' src='/MyJavascriptFile.js?20111129120000'></script>