Skip to content

Support DefaultVersion and CompanionFile in File element

Ygor Mutti requested to merge ygormutti/msitools:master into master

Hello!

I think the title of the MR is almost self-explanatory, so what follows are some use case scenarios for these attributes and the motivation behind the effort.

A third-party executable we include in a MSI built by wixl was being removed but not being installed again during a major upgrade, breaking the product. The fragment from the WXS which installs the EXE also uses it in a service, like this:

<Component Id="MyService.exe" Guid="*">
    <File Name="MyService.exe" Id="MyService.exe" Source="$(var.BuildDir)/winsw-signed.exe" KeyPath="true" />
    <ServiceInstall Id="ServiceInstaller" Interactive="no" Type="ownProcess" Name="MyService" DisplayName="MyService" Description="Monitoring and management Jobs" Start="auto" Account="[SERVICEACCOUNT]" Password="[SERVICEPASSWORD]" ErrorControl="normal" Arguments="" />
    <ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="MyService" Wait="yes" />
</Component>

In the installation log there were error message like this:

Disallowing installation of component: {MyService.exe-GUID} since the same component with higher versioned keyfile exists

This EXE is versioned by the third party, although both MSI and installed versions of the EXE were exactly the same. Also, creation and modification dates of the installed file were the same, so I still don't know why this error is happening.

I've tried many workarounds I found in blog posts and forums (some examples here), but none worked. So I've read the project source code and discovered they depend on features not yet supported by wixl.

Since I was already familiar with the code, I decided to give a try to some initial versioning support, through DefaultVersion and CompanionFile attributes. Using the wixl from this branch to build the MSI solved the issue.

Please let me know what you think of this patch.

Thank you for your time,

Ygor

Edited by Ygor Mutti

Merge request reports