We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

IvanProdanov
Posts: 3
Joined: Tue Aug 25, 2015 2:21 pm

How to get list of file paths to the installed files in a custom dll?

Hello!

I'm using a .NET library as a custom action from Advanced Installer. The main class inherits the System.Configuration.Install.Installer .NET class. I've been using this configuration for quite some time now, which allowed me to read the custom properties I've set in the configuration .aip file of my installer.

Right now I'm trying to achieve something a bit more advanced. In the .aip file I've setup several files to be deployed in a specific folder. I would like to setup and configure only these files from my custom assembly, but I don't know how to get the list with their names. Currently I'm applying the operation to all the files in that folder, but this turns out to be a conflict if there's a file that hasn't been stored there from my installer.

Is there a way to get the list of files that the installer would store in that folder from my custom action dll?

Thanks in advance for the help!
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: How to get list of file paths to the installed files in a custom dll?

Hello and welcome to Advanced Installer forums,

Please note that each folder has an identifier attached. This is a property through which the folder can be identified or referenced by. You can check the attribute attached to a folder in the Folder Properties Tab.

After this step, you can append the files name and get the full path of each file.

Please let me know if that helped, otherwise give me more details about your specific scenario.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
IvanProdanov
Posts: 3
Joined: Tue Aug 25, 2015 2:21 pm

Re: How to get list of file paths to the installed files in a custom dll?

Hi Dan, thanks for the quick reply!

I would like to gather more info on getting the exact file names using that folder identifier.

But what you're saying is that I could append each filename in a property and pass the hardcoded property to the custom actioned dll. What I would like is to access that information from the custom action dll so that there's nothing hardcoded.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: How to get list of file paths to the installed files in a custom dll?

Hi Ivan,

For this you can add all the files from the related folder under a single component in the Organization page.

Then, you can create a custom action that will query the File table and are under the component that has been previously created.

In the File table you will see all the files contained by the .MSI and this is why you need to check if the files are under the related component. This way you will obtain the files installed in that folder.

Should there be any difficulty you encounter implementing something, please do not hesitate to contact me and I will gladly assist.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
IvanProdanov
Posts: 3
Joined: Tue Aug 25, 2015 2:21 pm

Re: How to get list of file paths to the installed files in a custom dll?

Hi Dan,

Thanks for the quick reply. Could you, however, upload a small demo project? I'm struggling to achieve what you described using the latest version of Advanced Installer.

Thanks in advance!

Best Regards,
Ivan
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: How to get list of file paths to the installed files in a custom dll?

Hi Ivan,

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:

Code: Select all

msiexec /i <path_to_msi> /L*V <path_to_log>
Here is what you need to do:
  • 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)
To execute you custom action, please use the predefined Call function from attached native DLL custom action.

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
Should there be any difficulty you encounter implementing something, please do not hesitate to contact me and I will gladly assist.

Best regards,
Dan
Attachments
How to get list of file paths to the installed files in a custom dll.zip
(722.05 KiB) Downloaded 236 times
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”