Monday, November 17, 2008

File versions vs. ProductVersion


Major upgrades in Windows Installer use only the first three fields of the ProductVersion property: the FindRelatedProducts action won’t distinguish version 1.2.3.4 of a product from version 1.2.3.5.

Some take this to mean that file versions in the File table are limited to three fields, which isn’t the case. The Version field of the File table uses the Version data type, described as xxx.xxx.xxx.xxx, where each field is an integer from 0 through 65536.

To demonstrate this, create a file called versions.exe with version 1.0.0.0 and place it in (say) C:\Program Files\Versions, and create another copy with version 1.0.0.1, adding it to an installer that installs it to that same directory. If you create a log file with msiexec /i version_test.msi /L*v everything.log, you can search for “file:” and find this (edited):

MSI (s): Executing op: FileCopy (SourceName=versions.exe, DestName=versions.exe,
Version=1.0.0.1, ...)
MSI (s): File: C:\Program Files\Versions\versions.exe; Overwrite; Won't patch;
Existing file is a lower version

Or I guess you could just have checked to see if the new file was installed.

If MSI considered the versions identical, the log message would be (strange capitalization and all):

MSI (s): File: C:\Program Files\Versions\versions.exe; Won't Overwrite; Won't patch;
Existing file is of an equal version

No comments: