And this is how we actually update it (throw back to old, old
build system goo, there are probably better ways these days):
if (5
> WScript.Arguments.length)
{
helpAndQuit();
}
var
FileSystem = new ActiveXObject('Scripting.FileSystemObject');
var
fileType = WScript.Arguments(0);
var
versionFile = WScript.Arguments(1);
var
startYear = WScript.Arguments(2);
var major
= WScript.Arguments(3);
var minor
= WScript.Arguments(4);
var
versionBuilder = new versionBuilder(startYear, major, minor);
var year
= versionBuilder.year;
var month
= versionBuilder.month;
var day =
versionBuilder.day;
var
buildNumber = versionBuilder.buildNumber;
var
version = versionBuilder.version;
var ts =
FileSystem.CreateTextFile(versionFile, true);
if
("cs" == fileType)
{
ts.WriteLine("using
System.Reflection;");
ts.WriteLine();
ts.WriteLine("//
Generated by build system.");
ts.WriteLine("//");
ts.WriteLine("//
Version information for an assembly consists of the following four
values:");
ts.WriteLine("//");
ts.WriteLine("//
Major Version");
ts.WriteLine("//
Minor Version");
ts.WriteLine("//
Build Number");
ts.WriteLine("//
Revision");
ts.WriteLine("//");
ts.WriteLine();
ts.WriteLine("[assembly:
AssemblyVersion(\"" + major + "." + minor +
".0.0\")]");
ts.WriteLine("[assembly:
AssemblyFileVersion(\"" + version + "\")]");
}
else
{
ts.WriteLine("<?xml
version=\"1.0\" encoding=\"utf-8\"?>");
ts.WriteLine("<!--
generated by build system -->");
ts.WriteLine("<Include>");
ts.WriteLine("
<?ifdef WixMajorMinor?>");
ts.WriteLine("
<?error WixMajorMinor variable is already defined?>");
ts.WriteLine("
<?endif?>");
ts.WriteLine("
<?define WixMajorMinor = \""+ major + "." + minor +
"\" ?>");
ts.WriteLine("
<?ifdef WixBuildNum?>");
ts.WriteLine("
<?error WixBuildNum variable is already defined?>");
ts.WriteLine("
<?endif?>");
ts.WriteLine("
<?define WixBuildNum = \"" + buildNumber + "\"
?>");
ts.WriteLine("
<?ifdef WixVersion?>");
ts.WriteLine("
<?error WixVersion variable is already defined?>");
ts.WriteLine("
<?endif?>");
ts.WriteLine("
<?define WixVersion = \"$(var.WixMajorMinor).$(var.WixBuildNum).0\"
?>");
ts.WriteLine("</Include>");
}
ts.Close();
WScript.Quit(0);
function
helpAndQuit()
{
WScript.Echo("syntax:
upver.js <cs|wxi> versionfile startyear major minor");
WScript.Quit(1);
}
function
versionBuilder(startYear, major, minor)
{
var
now = new Date();
this.day
= now.getDate();
this.month
= now.getMonth() + 1;
this.year
= now.getFullYear();
var
yearMonth = this.month + (this.year - startYear) * 12;
this.buildNumber
= (10 > yearMonth) ? "0" + yearMonth : "" + yearMonth;
this.buildNumber
+= (10 > this.day) ? "0" + this.day : "" + this.day;
this.version
= major + "." + minor + ".";
this.version
+= this.buildNumber;
this.version
+= ".0";
}
From: wix-devs-bounces@...
[mailto:wix-devs-bounces@...] On Behalf Of Jason
Ginchereau
Sent: Thursday, July 24, 2008 07:30
To: Windows Installer XML toolset developer mailing list
Subject: Re: [WiX-devs] Origin of the Wix build number
The WiX v3 build number has the form MMdd, where dd is the
current day of the month and MM is the number of months since we started
counting: 01/2005 = 01, 01/2008 = 37, 07/2008 = 43, etc.
The WiX v2 build number has a similar form but the counting
started with a different month.
I have been
looking through the source in the zip file, and have not been
able to determine how the include files which contain the build
number are being generated by the build system. Currently I
am using major upgrades to handle the removal and installation
of our tools for testing during our development process, but
the version is being updated manually. I’d like to “borrow”
the technique used by the toolset so any help would be
appreciated.
David