Using the TFS Build Number Task with TFS 2008


UPDATE: 13 July 08 — These tasks are now available in the FreeToDev MSBuild Tasks Suite

The sample code provided in the blog post covering this light weight task needs to be tweaked if using TFS 2008:

TFS 2005:

<GetBuildNumber BuildType=”$(BuildType)” BuildNumber=”$(BuildNumber)” Format=”Elapsed” StartDate=”1 Jan 2007” ZeroPadding=”4″ Major=”2″ Minor=”1″>
        <Output TaskParameter=”AssemblyFileVersion” PropertyName=”ElapsedBuildNo” />
</GetBuildNumber>
<GetBuildNumber BuildType=”$(BuildType)” BuildNumber=”$(BuildNumber)” Format=”Date” DateFormat=”MMdd” Major=”2″ Minor=”1″>
        <Output TaskParameter=”AssemblyFileVersion” PropertyName=”DateBuildNo” />
</GetBuildNumber>

TFS 2008:

<GetBuildNumber BuildType=”$(BuildDefinition)” BuildNumber=”$(BuildNumber)” Format=”Elapsed” StartDate=”1 Jan 2007” ZeroPadding=”4″ Major=”2″ Minor=”1″>
        <Output TaskParameter=”AssemblyFileVersion” PropertyName=”ElapsedBuildNo” />
</GetBuildNumber>
<GetBuildNumber BuildType=”$(BuildDefinition)” BuildNumber=”$(BuildNumber)” Format=”Date” DateFormat=”MMdd” Major=”2″ Minor=”1″>
        <Output TaskParameter=”AssemblyFileVersion” PropertyName=”DateBuildNo” />
</GetBuildNumber>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s