MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: Database Tables[Next]: Dual Purpose Packages
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Windows Installer FAQ (the basics)->Directories

Windows Installer Basics: Directories

All directories that you wish to use and all of its parent directories must be defined in the "Directory" table. If its missing a directory definition then the msi validation step should pick it up, failing that you will probably see a "2756" error during installation.

MAKEMSI has the "Directory" command to create these entries and the "DirectoryTree" command to define all the parent directories as well as the one you want in one hit.

Some directory related commands are:

  1. Directory
  2. DirectoryCompress
  3. DirectoryTree
  4. HtmlDirTable
  5. MapUserDir
  6. PropertyCa

Some directory related pages are:

  1. System Folder Properties
  2. File and Directory

Remember the Install location

This shows one way you can insure that the install location (in this case "INSTALLDIR") is remembered but defaults to a good value the first time:

;--- Create INSTALLDIR (remember where user wishes it installed) ------------
<$Property "INSTALLDIR" Persist="Y" PersistHow="PRODUCT FOREVER">
<$DirectoryTree Key="INSTALLDIR" Dir="[ProgramFilesFolder]\SomeProduct" CHANGE="\" PrimaryFolder="Y">
...

Note that the "PropertyCa" was not needed in the above, if you need to "work out" the correct install location then it would probably be used to set the "INSTALLDIR" property's value (with or without the "DIR" parameter specified as "Y").

Making Install Locations Adjustable at Install Time

A user can choose to perform a custom setup in which case they will be presented with a list of one or more Features that they can choose to install, each one of these could potentially install software into a different location and allow the directory to be selected by the user.

If you wish to supply your own dialogs then have a look at the "Browse Dialog - Changing Directory" tip.

It is very important to keep in mind that its generally possible for the user to adjust directory locations at install time, either via custom setup or command line. If you must hard code something then please also ensure that you validate the environment ("yes there is a "K:" as an example) and that you don't allow users to adjust the value (or have a custom action to detect the change and abort with an error message).

If you do any fancy directory manipulation or allow people to specify directory locations, I highly recommend that you confirm the value of the directories "property" during install, repair and uninstall (see the "Install - Verbose Logging" option). Confirm that files and shortcuts are removed as expected.


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: Database Tables[Next]: Dual Purpose Packages


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Saturday May 28 2022 at 3:11pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.