Reputation: 1058
I need use the $(Rev) property in an argument passed to MSBuild as part of my build process. I have defined MajorVersion
, MinorVersion
and PatchVersion
as variables in my build definition, and I can use these in my arguments. If I pass an argument to MSBuild that contains this string: $(MajorVersion).$(MinorVersion).$(PatchVersion)-beta$(Rev:r)
it evaluates to something like 1.3.2-beta$(Rev:r)
, which causes problems. If I pass this argument: $(MajorVersion).$(MinorVersion).$(PatchVersion)-beta$(Build.BuildId)
then it correctly resolves to something like 1.3.2-beta204
. I also in time would like to replace the SemVer tag with a variable, e.g. beta
, rc
, etc., so I can adopt a git-flow approach to my builds and versioning.
Any ideas why $(Rev) isn't usable?
Upvotes: 2
Views: 569
Reputation: 14164
Don't confuse build number format tokens with build variables.
$(Rev:.r)
is a one of the tokens, resolved by the TFS build in runtime. You were correct to pass the resolved variable which encapsulates the build number format.
Alternatively, you can use $(Build.BuildNumber)
in MSBuild with build number format 1.3.2-beta$(Rev:.r)
Upvotes: 2