Some sample code as promised. This should be enough to get you started.
The following JavaScript can be used to create an InnoSetup iss file containing the version number. The actual file will look like this:
VersionInfoVersion=1.2.3.12345
AppVerName=My App v1.2.3.12345
The main Inno Setup script will include this file by adding the following to the end of the [Setup] section:
[Setup]
AppId={{...}}
...
#include "version.iss"
Here is the JavaScript (this would be saved as a separate file - version.js for example):
createInnoSetupIncludeFile("My App", 1, 2, 3, 12345, "version.iss");
function createInnoSetupIncludeFile(appName, verMajor, verMinor, verSubMinor, buildNumber, headerFileName)
{
var versionString = verMajor + "." + verMinor + "." + verSubMinor + "." + buildNumber;
var fileSystemObject = WScript.CreateObject("Scripting.FileSystemObject");
var fileObject = fileSystemObject.CreateTextFile(headerFileName, true);
fileObject.WriteLine("VersionInfoVersion=" + versionString);
fileObject.WriteLine("AppVerName=" + appName + " v" + versionString);
fileObject.Close();
fileObject = null;
fileSystemObject = null;
}
You could tweak this script to create the version.iss file in a different folder.
Finally you need to execute the JavaScript - the best place would be in the Pre-Build Event of your Visual Studio project. Add the following:
cscript version.js //NoLogo
You would need to change this to also build a Wix compatible include file. I used to do this, but dumped Wix in favour of Inno Setup, so I don't have this code to hand. There is a mechamism for a Wix script though, so that should point you in the right direction - the concept is the same - generate a text file that defines the version number and then include it.
Hope this helps.