如何在构建事件中检索主要/次要/构建/修订号 [英] How can I retrieve major/minor/build/revision number on build events
本文介绍了如何在构建事件中检索主要/次要/构建/修订号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好!
我正在使用这段代码,在构建事件后复制一些文件:
I'm using this piece of code, to copy some files on post-build-event:
<PropertyGroup>
<DemoPath1>..\demoPath1</DemoPath1>
</PropertyGroup>
<Target Name="AfterBuild">
<Exec Command="robocopy $(ProjectDir)$(DemoPath1) $(ProjectDir)demoPath2/$(Revision) * /XD .svn _svn /XF *.cs /S" IgnoreExitCode="true" />
</Target>
如您所见,我想使用$(Revision)
-显然,这是行不通的...
As you can see, I would like to use $(Revision)
- obviously, this is not going to work ...
有人可以帮我吗?
@mods:我不知道要使用哪个标签,一方面是msbuild,另一方面是visual studio ...?随时编辑!
@mods: I dunno exactly which tag to use ... on the one hand it's msbuild, on the other one visual studio ...? feel free to edit!
推荐答案
最简单的方法是:
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
<Output TaskParameter="Assemblies" ItemName="AssemblyVersion" />
</GetAssemblyIdentity>
我已经用过这种方式:
<Exec Command="robocopy $(ProjectDir)$(SomeProperty) $(ProjectDir)somePath/%(AssemblyVersion.Version) * /S" IgnoreExitCode="true" />
这篇关于如何在构建事件中检索主要/次要/构建/修订号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文