How to install two files with the same name in the same folder?
The following article uses options that are available starting with the Professional edition and project type.
This option is very useful if you have multiple files with the same name and you want to install only one of them, for example, based on the OS version or language. After the installation process is complete, the correct file will appear in the install folder.
Because the operating system does not allow having two or more files with the same name in the same folder we will use a small trick. We will place each file under a separate sub-folder, then we will configure the installer project to not create those sub-folders, but instead install the file directly into the parent folder, based on a condition evaluated at install-time. Then, you need to design the install condition to be true for only one of the folders/files, as you'll see in our example below.
In order to install two or more files with an identical name in the same folder based on a condition, the following steps must be taken:
- Go to the Files and Folders page and select the folder that you want to hold the final file.
- In this folder create two sub-folders. For example: My_folder_1 and My_folder_2.
- In the first folder, My_folder_1, add the first file, Eula.rtf.
- In the second folder, My_folder_2, add the second file, Eula.rtf.
- Go to the parent folder, select the first sub-folder created previously (My_folder_1) and from the context menu select the Properties option.
- In the "Component" section of the "Properties" tab enable the Install folder content into the parent folder checkbox.
- Do the above step for the second folder.
- Go to the Organization Page and put each of the two files into a separate component.
- For each component, set the Install "Condition" based on which you want to install that file, as shown in the video below.
If you want to install a file based on a decision selected from the installer UI, be mindful that only public properties are passed from Wizard Dialogs Stage to Install Execution Stage.
Below is a link to a short video depicting the steps explained in this article.