|
|
Using Inno Setup to Create a Versioned InstallerAn important piece of any Windows suppport application is an installer that is easy to use. For Windows distributions, www.MicrochipC.com uses Inno Setup to generate custom setup executables. Inno Setup is superior to InstallShield in almost every way, its lightweight, simple, and easy to use. One feature that Inno Setup v5 lacks is auto-versioning support. Also referred to as auto-update or auto-upgrade, this is the ability for the application to handle upgrades seamlessly, or warn the user if they are downgrading the program. MicrochipC has released InnoSetupAV, a sample installer script and set of instructions to add seamless auto-versioning and upgrading support to existing InnoSetup scripts. Advantages
Requirements
SetupInstall Inno Setup v5 or above. Install the Inno Setup Preprocessor. This allows Inno Setup to handle #defines, and is essential for clean, maintainable scripts. Step-by-step instrucitonsTo insert the version into the Inno Setup script, add these lines:
; version
; 1. For the versioning to work correctly, vbuild must constantly increase for every release. ; 2. vbuild starts out at 1000 and will increment every build for the life of the program. ; 3. For example, it would go v1.5.1001, then v1.6.1002, then v1.7.1004, etc. ; 4. This behaviour can be altered to suit other versioning schemes by changing the functions below. #define vmajor 1 #define vminor 1 #define vbuild 2350 Define the application name: #define appname "MicrochipC PSU Utility"
Now that we have the version defined, we can auto-generate the filename: OutputBaseFilename={#appname} v{#vmajor}.{#vminor}.{#vbuild}
Now, we need to add a key to the registry to keep track of the currently installed version: [Registry]
; ---start autoupdate code; see http://agiletrack.net/samples/sample-istool-installer.html-- Root: HKLM; Subkey: Software\{#appname}; ValueType: string; ValueName: CurrentVersion; ValueData: {code:GetAppCurrentVersion|''}; Flags: uninsdeletekey ; ---end autoupdate code--- Dont worry about the function call in this line; this will be added later. Now, add funcitons to handle the versioning: ; ---start autoupdate code; see http://agiletrack.net/samples/sample-istool-installer.html-- function GetAppMinorVersion(param: String): String; function GetAppCurrentVersion(param: String): String; function GetAppID(param: String): String; function GetPathInstalled(AppID: String): String; function GetInstalledVersion(): String; function GetInstalledCurrentVersion(): String; function InitializeSetup(): Boolean; // read the installation folder if length(Prevdir) > 0 then begin function ShouldSkipPage(PageID: Integer): Boolean; DownloadDownload InnoSetupAV v1.00. TestsTry the following tests to see if the script is working as designed.
CommentsSend questions or comments to my email address. This applicaiton is free - enjoy! |
We welcome any suggesions or comments! Send them to Shane Tolmie on support@microchipc.com. This site is a completely separate site to www.microchip.com, and is maintained independently of Microchip Ltd., manufacturers of the PIC micro. All code on this site is free for non-commercial use, unless stated otherwise. Commercial use normally free, however, it is prohibited without contacting support@microchipc.com for permission. All content on this site created by Shane Tolmie is copyrighted by Shane Tolmie 1999-2009. Click to advertise on this website - $29.90 for a banner ad which will reach 55,000 user sessions per month. One months free trial! |