我在MoneDevelopment5.9.6中使用了xbuild 12。是的,它很旧。不,我不能升级。:)
我想将当前日期写入生成中的文件。通过搜索msbuild,我设置了类似的内容:
<Target Name="AfterBuild">
<WriteLinesToFile File="$(OutputPath)\version.txt" Lines="$([System.DateTime]::Now.ToString())" Overwrite="true" />
</Target>但是,当我在单开发环境中构建它时,我会得到以下错误:
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脚本,但是它已经开始得到了。
发布于 2017-04-05 21:52:00
这个版本似乎不支持属性函数。在Mac/linux上,您可以使用:
<Target Name="AfterBuild">
<Exec Command="date > $(OutputPath)\version.txt" />
</Target>https://stackoverflow.com/questions/43239030
复制相似问题