16009bf9f3
- 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.
39 lines
940 B
C#
39 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;
|
|
}
|
|
}
|
|
}
|