Controlling File Version Settings
Windows Installer provides a special property that controls the application of versioning rules to installation files. Setting the property REINSTALLMODE to various values affects how Windows Installer decides which files to replace and which to ignore during installation.
The default value of REINSTALLMODE is omus, which tells Windows Installer to replace only older files during installation. The REINSTALLMODE settings are made up of four letters explained in the following table:
- O Controls the file versioning rules and instructs Windows Installer to only replace older files. The following flags control file replacement:
- O - Replace older files
- A - Replace all files
- E - Replace files that have the same or older version number
- P - Do not replace any existing files, only install this file if the file doesn't previously exist
- M Rewrite Per-Machine registry keys
- U Rewrite Per-User registry keys
- S Recreate shortcuts
Linking Multiple Files
Another way to control file installation is to link two or more files together as a unit and make the installation of those files depend on the versioning rules of one of the files in the group. For example, assume that your .MSI contains an .EXE and a .DLL. Because when the .EXE changes, the .DLL also changes, you want to group these files so when the .EXE installs, the .DLL installs regardless of the version information.
To do this, use a Windows Installer feature called Companion Files. In the File table of the .MSI, enter that name of the .EXE in the Version column. At installation time, Windows Installer, by using versioning rules, determines whether to install the .EXE. Based on those rules, Windows Installer installs or doesn't install the .EXE and .DLL files together regardless what the independent versioning rules on the .DLL would have normally decided.
Installing Versioned Files
As previously mentioned, REINSTALLMODE controls how versioned files install on the destination computer. For most versioned file installations, the following rules affect the installation:
When installing a versioned file over a non-versioned file, Windows Installer installs the versioned file regardless the time/date stamp.
When installing language-specific files, Windows Installer installs the file with the language code that matches the language code of the .MSI. Windows Installer evaluates this rule after comparing the file versions. If your .MSI contains a file that is version 1.2.3 and the destination computer contains an existing that is version 1.0.0, Windows Installer overwrites the 1.0.0 file in all cases except when the 1.0.0 file matches the language code of the .MSI and version 1.2.3 does not.
Windows Installer prefers files that contain multiple language codes to files that support one language.
Installing Non-Versioned Files
Installing non-versioned files with Windows Installer differs from legacy script-based installation tools. Most users expect the file with the most recent date and time to be installed. However, Windows Installer does not use this method to determine non-versioned file installation and instead uses a two-step procedure.
First, Windows Installer compares the file's unique hash value generated for its content with the MsiFileHash table in the .MSI. If the hash values match, then Windows Installer determines the files are the same and does not replace the file on the destination computer.
If the hash values differ, Windows Installer compares the date/time stamp of the file on the computer. If the file's modification date is newer than its creation date, Windows Installer determines the file contains user-modified content and does not replace the existing file. To override this behavior, use companion files.
By understanding how Windows Installer handles different file-replacement scenarios, you can create a package that installs in a predictable manner. For more information about file versioning rules, see the topic titled File Versioning Rules in the Windows Installer SDK.
The Endpoint Management Community Blog is the perfect place to share short, timely insights including product tips, news and other information relevant to the Endpoint Management community. Any authenticated Connect member can contribute to this blog.
Comments
Companion Files
Like to add more about companion file.
companion file's installation state depends on
-> its own file versioning information
-> & versioning of its companion parent.
With the context of companion files, installation skipped for the parent file has a higher version.
file which is the key path for its component is not be a companion file because companion parent file determine the results in the versioning logic of the key path file.
To specify a companion file, the primary key of the companion parent in the File table must be authored into the Version column of the record for the companion
For example refer file table.
File My_one.dll is companion parent of File My_two.dll
if refer file table can see
File Name - My_one.dll Version - 8.0.1.0
File Name - My_two.dll Version - My_one.dll
Here Installation status of My_two.dll depends on Versioning rules and version of My_one.dll.
Hence if My_one.dll file get install My_two.dll file also get install regardless of version.
Regards
Harsh M
companion files
I think the companion files functionality can be very useful with non versioned files, typically text files.
If you need to create a patch or an updated MSI that has to overwrite a non versioned file, you could use a small created DLL or EXE with a version as the companion parent, and then use this new file as the version of the unversioned files. This will ensure the required files are updated, even if they have been modified. You would just need to be sure that you were not overwriting any user data.
If you need to create another update after the first, you can just increase the small created DLL or EXE file version and use this file next time.
Feedback
Are any of you using companion files for this?
Would you like to reply?
Login or Register to post your comment.