Unversioned files ignoring overwrite rules - Advanced Installer Community
Nick
Posts: 13
Joined: Tue Oct 17, 2017 1:46 am

Unversioned files ignoring overwrite rules

Hello guys,

I've recently become aware that certain unversioned files within my project seem to be ignoring the Windows Installer file versioning rules. These are *.xml and other resource files (test.xml and test_log in the attached sample). In the example, the .xml file is compressed but trials with simple uncompressed *.xml files produce the same result.

Are there any specific prerequisites I may be missing in terms of the files and how they're handled by the installer? In my tests, even if I assign companion files to these files, or version them within the Advanced Installer UI, they're still overwritten by older examples.

I've attached a link to a test resource which will hopefully let you replicate this behaviour. The "test.dll" is a small file I've included which shows correct adherence to the version rules. However, the test.xml and test_log files will overwrite newer versions of themselves (available within the NewVersion directory).

Thanks,
Nick

https://www.dropbox.com/s/vfy35vhmcb2p6 ... t.zip?dl=0
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Unversioned files ignoring overwrite rules

Hello Nick,

This happens when, for the file existing on disk before install time, the Modified and Create dates are the same or when the e Create date is later than the Modified date. In this case Windows Installer consider that the file from disk was not modified by the user and thus will overwrite it.

The only case when the file from the setup won't overwrite the one from disk is when the latter one has a Modified date later than its Create date. In this case Windows Installer label the file from disk as a user modified one and won't overwrite it.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Nick
Posts: 13
Joined: Tue Oct 17, 2017 1:46 am

Re: Unversioned files ignoring overwrite rules

Hello Daniel,

Thanks for clarifying the logic when it comes to file modified/create dates.

To summarise the problem here, I have various different installer packages which install some components which are shared amongst packages. However, if an older package is installed on top of a newer one, I don't want the newer shared files to be overwritten by the older ones. For versioned files like DLLs the default file overwrite logic seems to prevent this as expected.

However, I find that for the unversioned files in the resource I attached above, even if I assign them 'user specified' version number using the 'version' tab of the 'edit file' dialog, older files will still overwrite newer ones.

I've attached two additional AIP files to hopefully demonstrate what I'm trying to achieve. They use the same resources as in my prior attachment.

Thanks,
Nick
Attachments
1 File Overwrite Test New Vers.aip
(32.09 KiB) Downloaded 346 times
1 File Overwrite Test Old Vers.aip
(32.09 KiB) Downloaded 368 times
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Unversioned files ignoring overwrite rules

Hello Nick,

I apologize for such a delayed reply.

Please note that when using a "User specified" version into your setup project, this version number will be used for the related files only during installation process when Windows Installer compare the version of the file from the setup with the one of the file from disk. This custom version from the project is only used inside the comparison check, it won't be set for the installed file on disk after the installation.

Therefore when the old setup installs over the new one this is what happens:
1. the old setup has a custom file version (4.1.7) specified for the "test.xml" file
2. on disk exists a "test.xml" file installed by the new setup, but this is still an unversioned file;
3. during the file version comparison operation the file from the old setup project wins because it has a version, whereas the file from disk is unversioned

Thus this configuration won't help you to achieve what you need.

The only solution for your case will be to use the "Make companion of file" option and choose a version file to be companion for your unversioned files. Also, the unversioned files should be added in the same component (you should do so from "Organization" page) as their companion file. Please find attached your projects that I modified to use the "Make companion of file" option. I just added the xml and log file in the same component as your DLL file and set them to use the "Make companion of file" option pointing to your DLL file.
sample.zip
(10.07 KiB) Downloaded 418 times
All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”