NAnt exposes a lot of predefined functions (datetime, string, math, ...), is there some way to do this also in MSBuild and not by creating you're own assemblies
The fact is that I just need to put the current date (dd/mm/yyyy) in a variable to create a datetime-based folder.
In the MSBuild Reference on MSDN I didn't find anything suitable to collect this information.
kind regards
Steven

Functions in MSBuild
duck thing
Thank you for the information.
I searched yesterday after more info and found also some extra community created taskblocks.
regards,
Steven
ManishMenon
One Touch
deputydawg219
Bit late for this thread I expect, but this could be done using ..
in http://msbuildtasks.tigris.org/
Cheers
Warren Burch
filali-boon
Hi,
MSBuild doesn't have this concept but, there are some task repositories that you can check out. Those are:
Microsoft SDC Tasks
Tigris MSBuild Tasks
Here is a GetDate task I wrote previously.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Sedodream.MSBuild.Tasks
{
/// <summary>
/// MSBuild task that will make the date available to the user.
///
/// Sayed Ibrahim Hashimi (sayed.hashimi@gmail.com)
/// www.sedodream.com
/// </summary>
public class GetDate : Task
{
#region Fields
private string format;
private string date;
#endregion
#region Properties
/// <summary>
/// Optional input that specifies the format for the date that will be placed in
/// the <code>FormattedDate</code> output.
/// </summary>
public string Format
{
get
{
return this.format;
}
set
{
this.format = value;
}
}
[Output]
public string Date
{
get
{
return this.date;
}
}
#endregion
public override bool Execute()
{
DateTime now = DateTime.Now;
date = now.ToString(format, null);
return true;
}
}
}
Here is how you would use it.
<!--
Sample project file demonstrating the use of the GetDate task.
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Demo">
<UsingTask AssemblyFile="$(MSBuildShare)\Tasks\Sedodream.MSBuild.Tasks.dll" TaskName="GetDate"/>
<Target Name="Demo">
<GetDate Format="yyyyMMdd.hh.ss">
<Output PropertyName="DateValue" TaskParameter="Date"/>
</GetDate>
<Message Text="Date value: $(DateValue)"/>
</Target>
</Project>
Sayed Ibrahim Hashimi
www.sedodream.com