Searching for a Previous Application Version

If you want to upgrade a previous version of your application, it might be necessary to determine at installation time exactly where that previous version was installed. There are a number of ways to find this out:

  1. If the previous version was always installed at the same location, you can simply use that information where appropriate. If necessary, use project variables such as <ProgramFiles> to specify the location in a platform-independent manner.
  2. If the location of the previous version can vary, but its installation program stored the installation path in the registry along with other uninstallation information, you can use the <InstallLocationPrev> project variable. This works with many modern installation programs (including Tarma Installer), but most older installation programs do not provide this information.
  3. If the previous methods don't work, you can let Tarma Installer search for your application and use the result of the search to locate the previous version.

The remainder of this topic discusses the details involved in each method. Note that each of these methods can be combined with an automatic uninstallation of the previous version; see Uninstalling a Previous Application Version for details about that procedure.

A. Using a fixed location

If you know for certain that previous versions of your application were always installed in the same location, you can use that knowledge to ensure that the new version is installed in the same location as the previous one - if that is what you want. To use this method, act as follows.

  1. Go to the Advanced - Variables page.
  2. On this page, create a new variable, for example AppFolderPrev. See Dealing with Common or Changeable Text Fragments for details.
  3. Set the Value (all or 9x) field to whatever folder is used by the previous version of your application. If possible, use predefined variables such as <ProgramFiles> to ensure that Tarma Installer resolves the folder location appropriately for each Windows version.
  4. On the Installation page, use the newly created variable as part of the Application folder field. For example, you can set this field to <AppFolderPrev> if you always want to use the same location as the previous version did.

With this approach, you can use <AppFolderPrev> anywhere in your project to refer to the previous version's installation location. If you don't need this, you can skip steps 1-3 and simply enter the previous version's installation folder directly in the Application folder field, again using project variables such as <ProgramFiles> as appropriate.

B. Using <InstallLocationPrev>

If you know that the previous version's installation program stored its installation location along with other uninstallation information (Tarma Installer and some other installation programs do this), you can use the predefined <InstallLocationPrev> variable to refer to that location. At installation time, Tarma Installer will look up the installation location and substitute its value wherever you use it. To use this method, act as follows.

  1. On the Installation page, check the Previous version uninstaller key.
  2. Enter the name of the previous version's uninstaller registry key. You may have to use the Windows RegEdit application to find this name under the HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall registry key. If the previous version used a Tarma Installer installation program, the default value <Uninstall> is usually appropriate.
  3. If you want Tarma Installer to perform an automatic uninstallation of the previous version, leave the Previous version uninstaller key box checked; if you don't want to uninstall the previous version (but only want to use its location, for example), clear the box. See Uninstalling a Previous Application Version for details about automatic uninstallation.
  4. To use the previous version's location (if any) as the default installation location for the new version, go to the Installation page and set the Application folder field to <InstallLocationPrev=!<ProgramFiles>\<AppTitle>>. If desired, you can vary the part after the '=!' separator to provide a different fallback location. See Project variables in the online help for details about this syntax.

With this method, Tarma Installer will use the previous version's location if it is available, or fall back to a suitable default if no previous version is present on the customer's system.

C. Searching for the application

If neither of the previous methods is available to you, Tarma Installer can search for a previous version at installation time. This requires the use of an extension DLL that is included with Tarma Installer version 2.51 and later; if necessary, download the latest version to obtain this functionality.

The general idea with this method is that Tarma Installer searches for one or more 'key' files that belong to the previous version of your application, then uses the folder in which the key file is found as the previous version's installation folder. Typically, you will want to search for the previous version's main executable program, but you can also use other files. For added flexibility, you can use wildcards in the key file specification, and you can specify more than one folder in which to search for the file. Tarma Installer will automatically search all subfolders of a given search folder.

To use this method, act as follows.

  1. Go to the Advanced page.
  2. On this page, check the Include Extension DLL box.
  3. Click on the '...' (browse) button to select the special search DLL. The DLL file that you need is called TixSearch.dll and is stored in the Tarma Installer Stubs folder; usually, this is C:\Program Files\Tarma Installer\Stubs.
  4. Go to the Advanced - Variables page.
  5. On this page, modify the following variables by setting their Value (all or 9x) fields:
  6. To use the previous version's location (if any) as the default installation location for the new version, go to the Installation page and set the Application folder field to <KeyFolder=!<ProgramFiles>\<AppTitle>>. If desired, you can vary the part after the '=!' separator to provide a different fallback location. See Project variables in the online help for details about this syntax.

With this method, Tarma Installer will use the previous version's location if the key file is found, or fall back to a suitable default if no previous version is present on the customer's system.