Inserting Build Date and Time in a Property

Is the possible to create a property in the build script which contains the current date and time for a build?

Thank you.

[137 byte] By [jamil] at [2007-12-21]
# 1

This information is not currently available in the build script, but it should be fairly simple to write a custom task to provide it. The markup would look something like:

<UsingTask TaskName="MyNamespace.GetDateTime" AssemblyFile="MyNamespace.GetDateTime.dll" />

...

<Target Name="TargetToOverride">

<GetDateTime>

<Output TaskParameter="CurrentDateTime" PropertyName="CurrentDateTime" />

</GetDateTime>

</Target>

You would then just need to write a custom task which sets a public property called CurrentDateTime to something like DateTime.UtcNow in its Execute method, pick the team build target you wish to override (if you want this information available from right at the beginning of the build, I would suggest BeforeEndToEndIteration), etc.

-Aaron

AaronHallberg at 2007-9-10 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Build Automation...

Visual Studio Team System

Site Classified