Hi,
This could be done by following these steps:
- go to the
Search page and create a new file search
- configure it to find the file you need
- rename the search to something meaningful, for example MY_FILE (this is actually an installer property)
- go to the "Prerequisites" page and select the
Custom Launch Conditions tab
- create a launch condition which looks like this:
Code: Select all
MY_FILE A file was not found on your machine
- use a custom action to get from the search property the path of the folder which contains the file (a sample custom action can be found in the
Remove a file or a folder during installation how-to)
- use the property set by the custom action (MY_FILE for example) to create a property-based folder in the "Files and Folders" page
- place the new version of the file in this folder
When the package runs the search will try to find the file. If it is not found the MY_FILE property is empty and the custom launch condition is not met (the installation stops). Otherwise, the custom action retrieves the path of the folder which contains the file and sets it into a property. This property sets the path of a property based folder so the new version of the file will be installed in the folder of the old version.
Regards,
Cosmin