Here's a sample project where you can see how to interact with the MSI database at runtime, through a custom action.
The sample project is attached to this thread, so if you are interested to take a look directly at my project, you are more than welcome to download the ZIP file. For debugging purposes, the full path of each file will be written in the log. There is no need to perform a full install. To create a log file, please use the following command line statement:
Here is what you need to do:
Code: Select all
msiexec /i <path_to_msi> /L*V <path_to_log>
- In your Advanced Installer project, please add the files from the related folder under the same component
- In your custom action you need to do this:
- Iterate through the files from the File table and get those files that have the related component.
- Compose the full path (folder's path + file name)
If you will create a log for the sample .msi, you should see the following in the log:
Code: Select all
Calling custom action Get files path from same component!Get_files_path_from_same_component.CustomActions.GetFilesPath Begin GetFilesPath custom action Database open Database openned File table openned The files that are assigned under the *OtherFileCopy2* component are: C:\Program Files (x86)\Your Company\Your Application\aFolder\OtherFileCopy2.txt C:\Program Files (x86)\Your Company\Your Application\aFolder\OtherFile.txt C:\Program Files (x86)\Your Company\Your Application\aFolder\OtherFileCopy.txt C:\Program Files (x86)\Your Company\Your Application\aFolder\OtherFileCopy3.txt C:\Program Files (x86)\Your Company\Your Application\aFolder\OtherFileCopy4.txt End GetFilesPath custom action