Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Some sample code as promised. This should be enough to get you started.</p> <p>The following JavaScript can be used to create an InnoSetup iss file containing the version number. The actual file will look like this:</p> <pre><code>VersionInfoVersion=1.2.3.12345 AppVerName=My App v1.2.3.12345 </code></pre> <p>The main Inno Setup script will include this file by adding the following to the end of the <strong>[Setup]</strong> section:</p> <pre><code>[Setup] AppId={{...}} ... #include "version.iss" </code></pre> <p>Here is the JavaScript (this would be saved as a separate file - version.js for example):</p> <pre><code>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; } </code></pre> <p>You could tweak this script to create the version.iss file in a different folder.</p> <p>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:</p> <pre><code>cscript version.js //NoLogo </code></pre> <p>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.</p> <p>Hope this helps.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload