Changing the Target Location for a Directory
If possible, the best way to specify the target location for a directory is to author the Directory Table in your installation package to provide the correct location. For more information, see Using the Directory Table.
If you need to change the directory location at the time of the installation, you have the following options:
- Specify the location of a directory by setting the value of a Public Property on the command line. During the CostFinalize Action, the internal directory paths used by the installer are updated to the value of properties listed as keys in the Directory Table. For more information, see Using Properties and Setting Public Property Values on the Command Line.
- Specify the location of a directory by using a custom action. If the custom action is to run before the CostFinalize Action, you can use a Custom Action Type 51 to set the value of a property from a formatted text string. If the custom action runs after the CostFinalize Action, you can use a Custom Action Type 35 to set the value of the directory path from a formatted text string. Custom actions that change one of the System Folder Properties should be included in both the execution sequence tables (InstallExecuteSequence Table or AdminExecuteSequence Table), and the user interface sequence tables (InstallUISequence Table and AdminUISequence Table) so that the folder is changed during both full UI and basic UI installations.
- If the installation is running a full UI, you can use MsiSetTargetPath or the SetTargetPath ControlEvent to set the directory path. Check the ProductState Property to determine whether the product that contains this component is already installed before calling MsiSetTargetPath or the SetTargetPath ControlEvent. Do not attempt to change the target directory path if some components that use that path are already installed for the current user or a different user.
The following restrictions apply to all of the above options:
- Do not attempt to change the target directory path if some components that use the path are already installed for the current user or for a different user.
- Do not attempt to change the target directory path during a Maintenance Installation.