JordyMeng2
Posts: 22
Joined: Tue Jul 06, 2021 3:41 pm

Overwriting fails

Hi,

I have an installer which needs to overwrite certain files, with the same name, in a parent folder since a user is able to select a certain language and based on that the correct language files need to overwrite the old files. Now I notice that the new files are not able to overwrite the files in the same folder.

To explain it a bit better:
- There is a folder named Pkg and a sub folder named Config. Within this sub folder there are certain files.
- There are 14 folders named after different languages. These folders are being installed to the parent folder aka the Pkg/Config folder.
- Within these 14 language folders there is also a folder named Pkg/Config which contains 6 template files (.tpl) which need to be copied to the main Pkg/Config file based on a checkbox with language selection.
- The main Pkg/Config folder already contains these 6 template files so they need to be overwritten when being installed.

My question is, why can't I overwrite these 6 template files? These template files have no version numbering so it means Windows Installer looks at Modified/Created date and checks if the user didn't modify the file for it to be overwritten. The file hasn't been modified since it is being installed in the main Pkg/Config folder and copied from the Language/Pkg/Config folder to the main Pkg/Config folder. They have the same names. When I debug the installer I get the following message:

File: C:\Program Files\DataFlex 99.0\Pkg\Config\WindowsProject.tpl; Overwrite; Won't patch; Existing file is unversioned and unmodified - no source file hash provided to compare

If the files are unversioned and unmodified they should be overwritten? Or am I seeing this wrong? Could it be that both files are being installed rather than already existing on the target machine? Could you please give me some assistance regarding this matter so I understand better why these files refuse to overwrite?

Thanks,

Jordy
Catalin
Posts: 7845
Joined: Wed Jun 13, 2018 7:49 am

Re: Overwriting fails

Hello Jordy,

Normally, non-versioned files are not overwritten. This is the default behavior of Windows Installer.

To avoid this, you can use the "Always overwrite existing file" option by:

- going to "Files and Folders" page

- right click on the file --> "Properties" --> "Operations" tab

You can find more information about this option here:

File Operations Tab
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.
Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
JordyMeng2
Posts: 22
Joined: Tue Jul 06, 2021 3:41 pm

Re: Overwriting fails

Hi Catalin,

Thank you for your reply.

I have tried this solution. I have set all File Operations of these 6 template files to "Always overwrite existing file" but the file still doesn't get overwritten. When I debug the installer I see that it's still giving the same message which is:

MSI (s) (90:20) [17:18:14:029]: File: C:\Program Files\DataFlex 99.0\Pkg\Config\WindowsProject.tpl; Overwrite; Won't patch; Existing file is unversioned and unmodified - no source file hash provided to compare.

Only if I remove the existing WindowsProject.tpl file it works since nothing has to be overwritten anymore. So for some reason Windows Installer is refusing to overwrite the file even if "Always overwrite existing file" is enabled. I have tried giving both file a version number and give the new file a higher version number. That doesn't work either.

Jordy
Catalin
Posts: 7845
Joined: Wed Jun 13, 2018 7:49 am

Re: Overwriting fails

Hello Jordy,

Could you please make sure that the file's component does not have the "Permanent" and "Never overwrite" attributes set to it?

Component Properties

You can do so by going in the "Files and Folders" page --> right click on your file --> "Go to Component"

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
JordyMeng2
Posts: 22
Joined: Tue Jul 06, 2021 3:41 pm

Re: Overwriting fails

Hi Catalin,

Unfortunately all components are not marked as Never Overwrite or Permanent. I think I am just going to give up on overwriting the files since it's not working at all. I would suspect that "Always overwrite files" would have done the job but it doesn't. I am just going to make sure there are no files existing with the same name. That's the only way that works currently.

Thanks for your help anyway, Catalin. Have a good day.

Jordy
Catalin
Posts: 7845
Joined: Wed Jun 13, 2018 7:49 am

Re: Overwriting fails

You are always welcome, Jordy!

If there is anything else I could help you with, please let me know.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”