Opentk/Source/Build.Tasks/DateStamp.cs
the_fiddler dd257ee29d Added Build.Tasks project that contains custom MSBuild tasks for the compilation process:
- DateStamp, which generates a version number based on the current date.
- DelTree which mimics RemoveDir but can delete non-empty directories on xbuild 2.6.x (which only supports empty directories).
- Run which mimics Exec but also captures stderr/stdout.
2010-10-02 22:15:19 +00:00

40 lines
940 B
C#

using System;
using System.Globalization;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Build.Tasks
{
/// <summary>
/// Returns a date stamp in the form yyMMdd.
/// </summary>
public class DateStamp : Task
{
string date;
/// <summary>
/// Gets a <see cref="System.String"/> represting the date stamp.
/// </summary>
[Output]
public string Date
{
get { return date; }
private set { date = value; }
}
public override bool Execute()
{
try
{
Date = DateTime.Now.ToString("yyMMdd", CultureInfo.InvariantCulture);
}
catch (Exception e)
{
Log.LogErrorFromException(e);
return false;
}
return true;
}
}
}