Using TfsVersion in BuildNumberOverrideTarget

Dec 27, 2008 at 3:08 AM
Edited Dec 27, 2008 at 3:12 AM

FANTASTIC FRAMEWORK!  Very impressed with the depth and quality of this code.  There's a lot to be proud of. :)

I'm currently attempting to use TfsVersion in BuildNumberOverrideTarget to set the BuildNumber as such:

{{

 

<

 

 

Target Name="BuildNumberOverrideTarget">

 

<

 

 

Message Text="Current number set to &quot;$(BuildNumber)&quot;" />

 

<

 

 

MSBuild.ExtensionPack.VisualStudio.TfsVersion TaskAction="GetVersion" BuildName="$(BuildDefinition)" TfsBuildNumber="$(BuildNumber)" Major="1" VersionFormat="Elapsed" StartDate="4/1/07">

 

<

 

 

Output TaskParameter="Version" PropertyName="BuildVersion" />

 

</

 

 

MSBuild.ExtensionPack.VisualStudio.TfsVersion>

 

<

 

 

PropertyGroup>

 

<

 

 

BuildNumber>$(TeamProject)_$(BuildDefinitionName)_$(BuildVersion)</BuildNumber>

 

</

 

 

PropertyGroup>

 

<

 

 

Message Text="Build number set to &quot;$(BuildNumber)&quot;" />

 

</

 

 

Target>

 

 

 

 

}} 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

This works fine and dandy the first time, however on the subsequent queued build, it fails because the Revision isn't updated.  If at all possible, it'd be great to have the ability to increment the revision by one within the GetVersion task.

Keep up the great work!
MichaelD

Dec 27, 2008 at 3:10 AM
DAMN!  Talk about butchering code.  There's gotta be a better way to format that!
Dec 27, 2008 at 3:12 AM
Edited Dec 27, 2008 at 3:13 AM
Crap... I give up, heh.
Coordinator
Jan 5, 2009 at 6:16 PM
Hi Michael

Sorry for the late reply, I've been away. This is a known issue and I added a small note to the help file for 3.5.1.0 --- 'Please Note: The output of GetVersion should not be used to change the $(BuildNumber). For guidance, see: http://freetodev.spaces.live.com/blog/cns!EC3C8F2028D842D5!404.entry'.

It basically comes down to a bug in TFS. see this post: http://www.codeplex.com/MSBuildExtensionPack/WorkItem/View.aspx?WorkItemId=605

I will make the 'note' more prominent.

Hopefully the blog post on lightweight versioning helps you.

Mike