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:
- 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.
- 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.
- 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.
- Go to the Advanced - Variables page.
- On this page, create a new variable, for example AppFolderPrev.
See Dealing with Common or Changeable Text Fragments
for details.
- 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.
- 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.
- On the Installation page, check the Previous version uninstaller
key.
- 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.
- 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.
- 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.
- Go to the Advanced page.
- On this page, check the Include Extension DLL box.
- 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.
- Go to the Advanced - Variables page.
- On this page, modify the following variables by setting their Value
(all or 9x) fields:
- KeyFile - Enter the file name (only) of the file that you want
Tarma Installer to search for. Typically, you will enter the name
of the previous version's main executable, but it can be any file
that uniquely identifies the previous version of your application
and that is stored in its installation folder. Wildcards are allowed.
- KeyFolder - Leave blank or set to an appropriate default value.
Tarma Installer will set this variable to the folder path that contains
the key file if it's found, or will leave it as-is if the key file
cannot be found. Note: do not use <AppFolder>
to specify a default value, because that will lead to infinite recursion!
- KeyPaths - Enter a list of folders to search for the key file;
separate the folders by ';'. Because Tarma Installer will automatically
search all subfolders of each folder in the search path, you only
have to specify a few likely top-level folders. Usually, it suffices
to enter <ProgramFiles> (which is also the default).
- 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.