How to add a timestamp to TFSBuild.proj?

旧时模样 提交于 2019-12-01 05:59:20

You don't need any third party support as long as you are using MSBuild 4.0. Just use a property function within a target,

<PropertyGroup>
  <DateTimeNow>$([System.DateTime]::Now)</DateTimeNow>
</PropertyGroup>

which will create the following value for $(DateTimeNow),

6/26/2011 9:00:27 PM
Jeff

You need to use the MS Build Community Tasks. It has a Time task that will give you what you want.

http://msbuildtasks.tigris.org/

 <Time Format="yyyy-MM-dd hh:mm:ss">
    <Output TaskParameter="FormattedTime" PropertyName="currentTime" />
 </Time>

You will need to setup a start and end time and you will need to be careful about where you invoke the tasks.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!