Hello,
First of all, I apologize for the delayed reply.
We can try to achieve this through a custom action that will delete your folder after the installation successfully ended. Here is how you can achieve this:
- Instead of adding your files as temporary files, you can create a new folder under
"Application Folder" and add them there. To do so, please go to
"Files and Folders" page --> right click on
"Application Folder" -->
"New folder" -->
"Regular". Now rename your folder as per your needs (e.g. "driver CP210")
- Now that you have created your folder, it is time to create the custom action that will delete it after the installation. To do so, please go to
"Cusotm Actions" page and add a
"Run PowerShell inline script" custom action
without sequence so we can trigger it from our exit dialog. In order to add a custom action without sequence, simply press the
"Add custom action without sequence" button which is placed to the right side of the custom action's name.
- Here is the code that will delete the earlier created folder after the installation successfully ended:
Code: Select all
$appDIR = AI_GetMsiProperty APPDIR
$path = $appDIR + "New Folder"
Remove-Item -path "$path" -recurse
You can copy-paste it under the "Your code goes here." comment. All you have to do is to replace "New Folder" with the name of your folder.
A little explanation: The full path to our folder is made up of two components and those are:
- the
"Application Folder" which is stored in the
"APPDIR" property.
- your folder.
The first line gets the value of the APPDIR property and stores it in the $appDIR variable. In the next line, we append our folder name to the $appDIR variable in order to obtain the full path to our folder. In the last line, we remove the folder using the "Remove-Item" cmdlet.
- The last step is to trigger the custom action from a dialog control. To do so, please go to
"Dialogs" page --> click on
"ExitDialog" --> click on the
"Finish" button --> click on the
"Published Events" tab --> click on
"New..." --> select
"Execute Custom Action" and as argument select the earlier created custom action. Leave the "Condition" field unchanged. After doing so, please schedule the event before the "Close the current dialog" event by selecting it and pressing the
"Up" button.
Important: If the folder location is on C drive, you may need privileges in order to delete it. To do so, please go to "Install Parameters" page and tick the
"Run as administrator" option from under the
"Installation Options" section.
Hope this helps.
All the best,
Catalin
FOLLOW US
Get the latest news in Application Packaging