We are trying to deploy an update to our product which contains an updated dll. This dll also has a version number so normally the installer should be able to see this and r
Similar Answer: File of a new component isn't installed because there was an old component with the same file
Companion Files: How to use Companion Files in WiX - just a snippet (after debugging it was discovered that OP had an issue of needing to downgrade files instead of a problem with number of version digits - very common issue):
<..>
<Component Id="MyFile.exe" Feature="Main">
<File Id="MyFile.exe" Source="MyFile.exe"></File>
</Component>
<Component Id="MyFile_2.exe" Guid="{0EBDFD64-017B-428F-BB67-3D82EA2A99AF}" Feature="Main">
<File Source="MyFile_2.exe" CompanionFile="MyFile.exe"></File>
</Component>
<..>
One-Line Summary: In the second component we point to the first component's file so that MyFile_2.exe will install whenever MyFile.exe is installed - regardless of versioning issues.
Older answer below left in for reference and the WiX source that can be used for testing.
MSI Version: Windows installer only cares about the first three numbers when checking version number.
File Version vs ProductVersion: The above statement is generally correct, but to the best of my knowledge (and based on a quick smoke test), this 3-digit restriction only applies to the MSI's ProductVersion (the version of the MSI itself), and not to actual file version numbers
.
File versions are respected in 4 digits, as opposed to the 3 digit limit for the MSI's ProductVersion (the version for the MSI itself). Please run a test yourself to be sure. Sample WiX markup to do so below.
REINSTALLMODE: The file-overwrite modifier mechanism REINSTALLMODE can be used to force overwrite files regardless of version. This mechanism must not be used since it can cause a number of problems: unnecessary reboot prompts, downgrading of system shared files, cause some files to be upgraded and others not (old and new packages installed out of sequence), in earlier versions of Windows crashes as protected files are attempted downgraded, etc...
WiX Mockup Test Source: I'll dump a simple test WiX source here to help you test this quickly (on different OS versions for example, I tested on Windows 10):
Incidentally, due to some inherent design characteristics of this sample, it will also illustrate that major upgrades fail when you only bump up the last digit of the 4-digit version number, but file overwrites will work. When you install version 2, you will find two product entries in Add / Remove Programs. This is expected based on the design of the sample. Just uninstall both.
<?define MyVersion = "1.0.0.0" ?>
<?define MyReleasePath = "$(sys.SOURCEFILEDIR)_Files\$(var.MyVersion)\" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="FileVersioning" Language="1033" Version="$(var.MyVersion)"
Manufacturer="FileVersioning" UpgradeCode="{4864AA4A-EA1D-4367-8427-85D296B0A2A6}">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="Main" Title="FileVersioning" Level="1" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="FileVersioning">
<Component Feature="Main">
<File Source="$(var.MyReleasePath)MyTestFile.exe"></File>
</Component>
</Directory>
</Directory>
</Directory>
</Product>
</Wix>
Usage:
_Files
and two further sub folders under there with two versions of the same file as illustrated below.
Open Folder in File Explorer
to get to the WiX project folder quickly.<?define MyVersion = "23.4.5.2" ?>
. This also affects where the sample expects the source file to be located on disk.<File Source="$(var.MyReleasePath)MyTestFile.exe"></File>
).<?define MyVersion = "23.4.5.3" ?>
).Folder structure for versioned files (create inside main project folder):
_Files
23.4.5.2\MyTestFile.exe
23.4.5.3\MyTestFile.exe
Open EXE as Resource: In Visual Studio try this:
File
=> Open
=> File
EXE
, DLL
, etc...
)Open
button => Open With...
Resource Editor
and open file.Version section
, open and double click entry.Links: