Summary
This article provides information regarding how to delete a file or folder during an install or uninstall.
Synopsis
This article applies to the following project types:
- Basic MSI
- InstallScript MSI
Windows Installer provides functionality for removing files during an installation by utilizing the RemoveFile table. Entries can be placed in this table to specify whether a file should be removed during an install, an uninstall, or both. This is useful when a product creates additional files at runtime that are not removed during the normal uninstall, the installed files to be removed during uninstall are modified by the user, or if there are files on the target system that must be removed during install.
Discussion
InstallShield 2014 and newer versions contain built-in functionality to remove files and folders. This can be accomplished in either the Setup View or the Files and folders view.
To configure file and folder removals through the Files and Folders view:
- In the View list under Application Data, click Files and Folders.
- In the Destination computer's folders pane, select the destination folder that contains the file or folder that you want to be removed.
- Right-click in the Destination computer's files pane and click Add File Removal. The Properties dialog box opens.
- Configure the settings as needed. For details, see File Removal Properties Dialog Box.
InstallShield adds a file or folder icon to the Destination computer's files pane. The icon has a red X through it to indicate that it is referencing an item to be removed.
To configure file and folder removals through the Setup Design view or the Components view:
- In the View list under Organization, click Setup Design (in installation projects) or Components.
- In the Setup Design or Components tree, expand the node of the component that contains the file or folder that you want to be removed, and then click the Files subnode.
- Right-click in the Files pane and click Add File Removal. The Properties dialog box opens.
- Configure the settings as needed. For details, see File Removal Properties Dialog Box. InstallShield adds a file or folder icon to the Files pane. The icon has a red X through it to indicate that it is referencing an item to be removed.
To edit the settings for a file or folder removal, right-click the removal item and then click Properties. The Properties dialog box opens, enabling you to edit the settings as needed.
For previous versions of InstallShield, there is no predefined support in the InstallShield Editor for specifying files and folders to be removed, however this functionality can be accomplished through the Direct Edit view of a project. The following example can be followed in order to remove the folder [INSTALLDIR]\Foldername and the file, filename.txt, contained within during an uninstall.
In the Files and Folder view, create the location of the folder in order to create a Directory table entry. Right click on the newly created folder, select Properties, and note the Directory Identifier (DIRECTORY_IDENTIFIER).
- Browse to the Direct Edit view and select the RemoveFile table.
- Right click and select Add new row and enter the following:
|
FileKey |
Component |
FileName |
DirProperty |
InstallMode |
|
FileKey1 |
Installed_Component |
filename.txt |
DIRECTORY_IDENTIFIER |
2 |
|
FileKey2 |
Installed_Component |
DIRECTORY_IDENTIFIER |
2 |
Additional Information
The FileKey column need only be unique. The Component column will need to match a component in the Component table. If the FileName column is blank, the folder specified in the DirProperty will be removed if it is empty. The InstallMode can be one of three values:
1 = Remove file during install.
2 = Remove file during uninstall.
3 = Remove file during install and uninstall.
Additional information on the RemoveFile table may be found in the MSDN article RemoveFile Table.
Related Articles
InstallShield 2018 Known Issues 4Number of Views InstallShield 2015 Known Issues 3Number of Views InstallShield 2014 Known Issues 4Number of Views Deleting report deletes the entire folder if the checkbox of the report is checked 5Number of Views Safe to Delete .prd files stored under C:\Program Files\FlexNet Operations\release\flexnet-data\data\prd folder 7Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add Additional feedback ( Optional )
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Case id: 00001065
Activity: Status change: 2 hours ago