diff --git a/Source/Build.Tasks/DateStamp.cs b/Source/Build.Tasks/DateStamp.cs
index 009dcafd..38f587d4 100644
--- a/Source/Build.Tasks/DateStamp.cs
+++ b/Source/Build.Tasks/DateStamp.cs
@@ -32,12 +32,10 @@ using Microsoft.Build.Utilities;
namespace Build.Tasks
{
- ///
- /// Returns a date stamp in the form yyMMdd.
- ///
public class DateStamp : Task
{
string date;
+ const string file = "../../Version.txt";
///
/// Gets a represting the date stamp.
@@ -53,12 +51,23 @@ namespace Build.Tasks
{
try
{
- // Build number is defined as the number of days since 1/1/2010.
- // Revision number is defined as the fraction of the current day, expressed in seconds.
- double timespan = DateTime.UtcNow.Subtract(new DateTime(2010, 1, 1)).TotalDays;
- string build = ((int)timespan).ToString();
- string revision = ((int)((timespan - (int)timespan) * UInt16.MaxValue)).ToString();
- Date = String.Format("{0}.{1}", build, revision);
+ // Version.txt contains the datestamp for the current build.
+ // This is used in order to sync stamps between build tasks.
+ // If the file does not exist, create it.
+ if (System.IO.File.Exists(file))
+ {
+ Date = System.IO.File.ReadAllLines(file)[0];
+ }
+ else
+ {
+ // Build number is defined as the number of days since 1/1/2010.
+ // Revision number is defined as the fraction of the current day, expressed in seconds.
+ double timespan = DateTime.UtcNow.Subtract(new DateTime(2010, 1, 1)).TotalDays;
+ string build = ((int)timespan).ToString();
+ string revision = ((int)((timespan - (int)timespan) * UInt16.MaxValue)).ToString();
+ Date = String.Format("{0}.{1}", build, revision);
+ System.IO.File.WriteAllLines(file, new string[] { Date });
+ }
}
catch (Exception e)
{
diff --git a/Source/Build.Tasks/GenerateAssemblyInfo.cs b/Source/Build.Tasks/GenerateAssemblyInfo.cs
index 1e7d77b7..5838f5e0 100644
--- a/Source/Build.Tasks/GenerateAssemblyInfo.cs
+++ b/Source/Build.Tasks/GenerateAssemblyInfo.cs
@@ -48,7 +48,9 @@ namespace Build.Tasks
public GenerateAssemblyInfo()
{
- Date = new DateStamp().Date;
+ DateStamp stamp = new DateStamp();
+ stamp.Execute();
+ Date = stamp.Date;
Major = Major ?? "0";
Minor = Minor ?? "0";
}
@@ -59,7 +61,7 @@ namespace Build.Tasks
using (StreamWriter sw = new StreamWriter(OutputFile, false, utf8))
{
- sw.WriteLine("// This file is auto-generated through Source.Build.Tasks/AssemblyInfo.cs.");
+ sw.WriteLine("// This file is auto-generated through Source/Build.Tasks/GenerateAssemblyInfo.cs.");
sw.WriteLine("// Do not edit by hand!");
sw.WriteLine();
diff --git a/Source/Build.UpdateVersion/Build.UpdateVersion.csproj b/Source/Build.UpdateVersion/Build.UpdateVersion.csproj
index 7986699e..4cc47d00 100644
--- a/Source/Build.UpdateVersion/Build.UpdateVersion.csproj
+++ b/Source/Build.UpdateVersion/Build.UpdateVersion.csproj
@@ -17,13 +17,43 @@
-
+
+
+
-
+
+