如何在 MSBuild 中输出时间戳
我正在使用 MSBuild/yuicompressor 来组合和缩小 JavaScript。
作为此过程的一部分,我想修改我的脚本引用,以便它们在查询字符串中具有时间戳。这样,当发布新版本时,用户始终可以获得文件的非缓存版本。例如:
<script type="text/javascript" src="/scripts/combined-minified.js?20100727" />
我使用 MSBuildCommunityTasks 中的 FileUpdate 来更新 参考,但它没有时间戳:
<FileUpdate
Files="@(includeFile)"
Regex="#scriptfiletoken#"
ReplacementText="<script type='text/javascript' src='/scripts/combined-minified.js' />"
/>
What is the best way to output this timestamp using MSBuild?
I am using MSBuild/yuicompressor to combine and minify JavaScript.
As part of this process, I want to modify my script references so they have a timestamp in the querystring. That way, a user always gets the non-cached version of the file when a new release is published. For example:
<script type="text/javascript" src="/scripts/combined-minified.js?20100727" />
I am using FileUpdate from MSBuildCommunityTasks to update the <script>
reference, but it does not have a timestamp:
<FileUpdate
Files="@(includeFile)"
Regex="#scriptfiletoken#"
ReplacementText="<script type='text/javascript' src='/scripts/combined-minified.js' />"
/>
What is the best way to output this timestamp using MSBuild?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个方法对我有用:
This method worked for me: