Set the file version environment variable

This commit is contained in:
Victor Hurdugaci 2015-03-27 19:35:12 -07:00
parent 9e872c3721
commit 188f5e8328
2 changed files with 20 additions and 0 deletions

View File

@ -3,6 +3,22 @@ use namespace="System"
functions functions
@{ @{
string CreateDayBasedVersionNumber()
{
var start = new DateTime(2015, 1, 1);
var now = DateTime.UtcNow;
string version = "0";
// If the computer date is set before the start date, then the version is 0
if (now >= start)
{
var monthsSinceStart = (now.Year - start.Year) * 12 + now.Month;
version = monthsSinceStart.ToString("000") + now.Day.ToString("00");
}
return version;
}
string BuildNumber string BuildNumber
{ {
get get

View File

@ -20,6 +20,10 @@ default Configuration='${E("Configuration")}'
{ {
E("DNX_AUTHOR", AUTHORS); E("DNX_AUTHOR", AUTHORS);
} }
if (string.IsNullOrEmpty(E("DNX_ASSEMBLY_FILE_VERSION")))
{
E("DNX_ASSEMBLY_FILE_VERSION", CreateDayBasedVersionNumber());
}
if (string.IsNullOrEmpty(Configuration)) if (string.IsNullOrEmpty(Configuration))
{ {
Configuration = "Debug"; Configuration = "Debug";