How do I specify the destination directory of the installation? What if ROOTDRIVE is not working?
The ROOTDRIVE property specifies the default drive for the destination directory of the installation.
The ROOTDRIVE property will not work as expected if you place files in Windows-defined folders, such as ProgramFilesFolder or ProfilesFolder. Windows Installer defines the location of Windows-defined folders during installation runtime. Please view the Windows Installer SDK article entitled "System Folder Properties" for a complete listing of folders that are not affected by the ROOTDRIVE property.
The destination directory of the installation can be manipulated by using the directory of the main program files as a property. Use a Set Directory custom action to define explicitly the destination path of a folder that is placed in a system-defined folder, such as ProgramFilesFolder. All files and sub-directories that are placed in the directory will be affected by the Set Directory custom action. Please follow the steps below to specify the location of the destination directory:
- Open the MSI Script and view the User Interface Sequence tab.
- Find the CostFinalize action in the User Interface sequence.
- Place a Set Directory custom action after the CostFinalize action.
- After selecting the Set Directory custom action from the Actions list, the Set Directory dialog will appear. Input the following fields on the Details tab on the Set Directory dialog. Example entries are shown for the fields below:
- Custom Action Name: Action
* Input a unique name to reference the action.
- Directory: INSTALLDIR
* Click the Browse... button to browse for the directory in your installation. After you select the directory, the internal name of the directory used by Windows Installer will be displayed in the Directory field.
- Directory Value: D:\MyApplication
* Input the desired destination path of the installed folder. Do not use trailing backslashes, as Windows Installer will add the backslash.
- Custom Action Name: Action
- You can accept the default values for the fields on the Properties tab.
- Click OK on the Set Directory dialog to save the custom action.
- Repeat steps 1–6 or simply copy the Set Directory custom action to the Execute Immediate sequence after the CostFinalize action, so that the installation supports silent installation. The User Interface sequence is ignored during silent installation of MSIs.
The preceding seven steps detail the procedure necessary to define explicitly the destination directory. It is not recommended to set the destination directory by using ROOTDRIVE or using a Set Directory custom action, unless the destination machine is a known environment. The user's machine may vary considerably. The destination machine may not have a desired drive letter that your installation is specifying.
Imported Document Id