How to install files in a custom folder
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.
1. Install in the "C:\" folder
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 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. To use this type of folder you can follow these steps:
- Go to the Properties Page 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 to this folder
When the installation runs, the path of the property-based folder will be set to the value of the property.
2. Install in a custom folder
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 build 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.
3. An example: installing in the user profile folder (Deprecated)
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 the 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".
The above method is deprecated. Starting with Advanced Installer 18.1 installing files in User Profile folder can be easily achieved by adding the files in User Profile field in Files and Folders page. More information here: How to deploy files in the User Profile folder