The following article uses options that are available starting with the Professional edition and project type.
The Files and Folders page offers a lot of predefined folders in which you can install files. The paths of these folders are explained in the Folder Paths article. However, when you need to install files into a custom location which is not present in the "Files and Folders" page, you need to define your custom path.
When installing an application you may need to install some files directly on the C: drive. This can be done in two ways:
You use the Windows Volume folder in the "Files and Folders" page. This folder is resolved at run-time to the drive which contains the Windows installation (usually it's the C: drive). If you use this folder you will make sure that your files are installed in the root of the system drive.
You use a property-based folder. In order to use this type of folder you can follow these steps:
- Go to the Install Parameters page
- Create a new property and name it MY_DIR (you can use any name you want as long as it contains only uppercase letters)
- Set the value of this property to C:\
- Go to the "Files and Folders" page
- Create a property-based folder by using the custom property
- Add your files in this folder
When the installation runs, the path of the property-based folder will be set to the value of the property.
Although it is not very obvious, most of the times when you need to install files into a custom folder you can use the "Files and Folders" page. This is because it contains predefined folders which cover all the important locations on the system drive.
For example, if you want to install files in the C:\MyFolder\MySubFolder directory, you can use the "Windows Volume" folder. After you create the MyFolder directory in "Windows Volume" and the MySubFolder directory in "MyFolder", you will obtain the path you need. This also applies to the other predefined folders ("Program Files", "Common Files" etc.).
However, if you cannot built the path you need by using the predefined folders, you can create a property-based folder which points to the path you want. For the above example, you would create a custom property which has the value C:\MyFolder\MySubFolder. This custom property can be used to create a property-based folder which will contain your files.
In order to install files or create sub-folders in the user profile folder (usually "Documents and Settings\<username>" on Windows XP and "Users\<username>" on Windows Vista or above) follow the steps below:
In the Files and Folders page create a new property based folder. In the "Select a property" dialog press the button, declare the USER_PROFILE property with none as "Default Value" and select it. You can now add content to this property based folder.
In the Custom Actions Page, under "Wizard Dialogs Stage -> Searches" create a new "Set installer property" Custom Action with the following settings:
Property Name : USER_PROFILE Formatted Text: [%USERPROFILE]
At install time the value of the USER_PROFILE Property will be set to the value of the USERPROFILE environment variable, which contains the full path to the current user's profile folder.
Keeping the SHIFT key pressed, drag-and-drop the custom action in tree control, under "Install Execution Stage -> Searches". This will create a copy of the action in Install Execution Stage.
Set the Scheduling Option for the custom action to “Skip action in Install Execution Stage if executed in Dialogs Stage” from Advanced Execution Scenarios dialog.
For both custom action instances set the Execution Condition to: USER_PROFILE="none".