File Operations Tab
Overwrite behavior
Specify the file's overwrite behavior.
Overwrite only if the existing file is older
When this option is selected, if the file on the target machine is older then the one included in the package, it will be overwritten.
Always overwrite existing file
If this option is enabled, the file from your package is overwritten and any similar file already present on the target computer. Usually, this can be used when performing a downgrade (install a file older than the one already installed) or for non-versioned files which don't overwrite the existing files.
Do not overwrite existing file
Condition when the file is preserved. To find out how to use this option in an upgrade scenario, you can follow the Prevent Repair or Uninstall article.
These options are also available for multiple editing of file properties.
Here’s how the Do Not Overwrite Existing File option works:
- Early Stage of Installation: The existing file on the disk is backed up by copying it to a temporary location. (AI_AiBackupImmediate is the custom action that handle this operation)
- File Replacement: The new file from the MSI package is installed in its place. (InstallFiles standard action from MSI)
- Restoration Stage: During the final stage of the installation, the backup file is restored, effectively overwriting the new file installed earlier (AI_AiRestoreDeferred is the custom action that handle this operation).
This mechanism ensures that the original file remains untouched after installation. However, the restoration process might fail if the file is in use during installation.