Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install a file regardless of version number with WiX

MyApp version 1.0 contained the file foo.dll. The version of this file was version 10.5.567. Now MyApp is version 2.0 and the version of foo.dll is 2.0.123. The version is LOWER than the old version. The vendor who wrote this dll decided to go backwards with the file version number. This is not a decision I can change.

How do I get WiX to always install this file?

The RemoveExistingProducts action is scheduled after the InstallFinalize action and also cannot be changed.

InstallShield had an 'always overwrite' flag but I don't think I can mimic this without changing the behavior of all files via a compiler switch. I do not want this. I just want to update THIS ONE file.

I have also tried

<RemoveFile Id="foo.dll" On="install" Name="foo.dll" />

But this did not work either. I end up getting 'Error 2753 The file foo.dll is not marked for installation' later.

like image 915
Mike Avatar asked Dec 16 '09 21:12

Mike


People also ask

Is WiX Installer open source?

It consists of a command-line environment that developers may integrate into their build processes to build MSI and MSM packages. WiX was the first Microsoft project to be released under an open-source license, the Common Public License.


1 Answers

It is really crazy this post is 10 years old and we also have this problem. The other approaches did not work for us.

How to solve it:

  1. All files which should be copied regardless of their version, must be in their own component
  2. Component element must have a unique Guid, not a *
  3. Set KeyPath to no in the inner File element

Example:

<Component Id="cmpExample" Guid="{5ABE7229-C247-4CBA-B8DE-2C4968CD103E}" >
     <File Id="fileExample" KeyPath="no" Source="$(var.TargetDir)\SomeExample.dll" />
</Component>

I would recommend to aggregate all those component elements in a component group. And furthermore you can use XML Transformation to get rid of those files if you use heat.exe to harvest all your files.

With this solution you can copy the file, even if the installed file version is higher. And it still works as expected when a higher file version will be installed with your upgrade.

like image 55
ringwaldK Avatar answered Oct 19 '22 22:10

ringwaldK