2017-04-05 31 views
0

我在monodevelop中使用xbuild 12 5.9.6。是的,这是旧的。不,我无法升级。 :)用xbuild写入日期

我想将当前日期写入构建文件。我已经建立了这样的事情,通过在google的MSBuild:

<Target Name="AfterBuild"> 
    <WriteLinesToFile File="$(OutputPath)\version.txt" Lines="$([System.DateTime]::Now.ToString())" Overwrite="true" /> 
</Target> 

然而,当我在MonoDevelop中构建它,我得到这个错误:

Error: Error executing task WriteLinesToFile: Error converting Property named 'Lines' with value '$([System.DateTime]::Now.ToString())' to type Microsoft.Build.Framework.ITaskItem[]: The requested feature is not implemented. (Server) 

因此,它看起来像我的运气?有没有一种功能的方式xbuild可以做到这一点?最好用一些自定义格式。我可以使用的一个回退是运行一个小型的Python脚本,但它开始获得Rube Goldbergy。

回答

1

看来这个版本不支持属性功能。在Mac/linux上,您可以使用:

<Target Name="AfterBuild"> 
    <Exec Command="date > $(OutputPath)\version.txt" /> 
</Target>