How do I manually populate the RemoveFile
table without using Installation Expert?
Removing an existing file during an installation through the RemoveFile table:
During an installation, you might want to remove existing files from the destination computer. This article outlines the steps to populate the RemoveFile table manually. This can also be done through the GUI interface in Installation Expert's Files page, by selecting the Operation button then the Remove File option.
To manually add a component, create a property to hold the location to find the file and populate the RemoveFile table follow the steps below:
Create a component:
- Create or open an installation in Wise for Windows Installer or the Windows Installer Editor.
- Go to the Components tab in Setup Editor.
- Add an empty component by right-clicking the Components icon and selecting New > Component.
- In the Component Details dialog box, enter a name in the Component field. Accept the defaults for the remaining fields. Click OK.
- The Select Feature(s) to Assign Components to dialog will appear if the installation contains multiple features. If you want the file to be removed during every installation, check the box next to a feature that will always be installed to the destination computer.
Create a property to hold the path to the file:
- Go to the Product tab in Setup Editor.
- Right-click the Properties icon and select New > Property.
- In the Property Settings dialog box, enter a property (all uppercase) in the Property field.
- In the Value field, enter the directory path on the destination computer that contains the file you want to delete. For example, C:\Program Files\MyFolder.
- Click OK.
Populate the RemoveFile table:
- Go to the Tables tab in Setup Editor and select the RemoveFile table.
- In the left pane, right-click on the RemoveFile table and select New > Row to create a new row.
- In the new row that appears in the right pane, enter the following fields:
- FileKey: Enter any unique value.
- Component: From the drop-down list, select the name of the component that you created.
- FileName: Enter the name of file you want to delete.
- DirProperty: Enter the name of the property that contains the file pathname as a value, for example XYZ.
- InstallMode: Enter one of the following depending on your preference:
1=Remove only when the associated component is being installed.
2=Remove only when the associated component is being removed.
3=Remove in either of the above case.
Note: Windows Installer will not delete a folder if files are in the folder. To first remove the files then the folder, you will need to add two entries following the steps above and populating the FileName field as shown below:
- The first entry would delete all files to ensure that the target folder is empty. Entering an * (asterisk) as a wildcard in the FileName field will remove all the files from the folder.
- The second entry removes the empty folder. Leaving the FileName field empty will delete an empty folder.