3
votes

My frustration level is nearing 10. I've been working on a wix installer for a couple weeks now. This installer installs prerequisites for our software. I don't have Visual Studio so I made a batch file to build (read command line only) the wix project. There are about 9 prerequisites which include .msi, .msu, and .exe files in this bundle.

My question relates specifically to the ExePackage described in the chain element. It seems several (but not all) ExePackages always install regardless of the DetectCondition, InstallCondition, on Install, and on Unistall. The log file shows the DetectCondition = true and the InstallCondition = false but these problem ExePackages still execute and install. Every. Time.

I read somewhere on stackoverflow in the past two weeks of frustration, that ExePackages don't allow the same visibility by the installer as .msi files and that can cause problems with exactly what I'm dealing with. I seem to remember someone mentioning how, on uninstall, the ExePackage gets executed and if the actual .exe file doesn't have the proper internal flags, it will install instead of uninstall. However, if I remember correctly, although those answers were good for their questions, I haven't been able to find something that completely prevents the execution of the ExePackage under certain conditions.

EDIT 1: I'm using WiX Version 3.7.

I'd like an example or some lifeline giving me a clue about how to do this. Here's an example of a problem ExePacakge:

...
<Bundle Name='MySoftware' Version='1.0.0.0' Manufacturer='MyCompany'
    UpgradeCode='{GUID}'
    Condition='(VersionNT >= v6.1 AND ServicePackLevel >= 1)'>

    ...
    <util:FileSearch Id='CheckChromeVersion' Path='[ProgramFilesFolder]Google\Chrome\Application\chrome.exe' Variable='CHROMEVERSION' Result='version' />
    <util:FileSearch Id='CheckChromeExists' Path='[ProgramFilesFolder]Google\Chrome\Application\chrome.exe' Variable='CHROMEEXISTS' Result='exists' />
    ...

    <Chain>
        ...
        <ExePackage Id='Chrome' 
            Compressed='yes' 
            SourceFile='.\installers\ChromeStandaloneSetup64-v51.0.2704.103.exe'
            PerMachine='yes'
            DetectCondition='CHROMEEXISTS AND CHROMEVERSION="51.0.2704.103"'
            InstallCondition='(NOT CHROMEEXISTS) OR (NOT CHROMEVERSION="51.0.2704.103")' />
        ...
    </Chain>
</Bundle>
...

And here are all instances of 'chrome' from the log file:

[0910:0794][2017-09-20T06:30:33]i000: Setting numeric variable 'CHROMEEXISTS' to value 1
[0910:0794][2017-09-20T06:30:33]i000: Setting version variable 'CHROMEVERSION' to value '51.0.2704.103'
[0910:0794][2017-09-20T06:30:33]i052: Condition 'CHROMEEXISTS AND CHROMEVERSION="51.0.2704.103"' evaluates to true.
[0910:0794][2017-09-20T06:30:33]i101: Detected package: Chrome, state: Present, cached: None
[0910:0794][2017-09-20T06:30:34]i052: Condition '(NOT CHROMEEXISTS) OR (NOT CHROMEVERSION="51.0.2704.103")' evaluates to false.
[0910:0794][2017-09-20T06:30:34]w321: Skipping dependency registration on package with no dependency providers: Chrome
[0910:0794][2017-09-20T06:30:34]i000: Setting string variable 'WixBundleLog_Chrome' to value 'C:\Users\User\AppData\Local\Temp\MyProgram_20170920063033_2_Chrome.log'
[0910:0794][2017-09-20T06:30:34]i000: Setting string variable 'WixBundleRollbackLog_Chrome' to value 'C:\Users\User\AppData\Local\Temp\MyProgram_20170920063033_2_Chrome_rollback.log'
[0910:0794][2017-09-20T06:30:34]i201: Planned package: Chrome, state: Present, default requested: Absent, ba requested: Absent, execute: Uninstall, rollback: Install, cache: Yes, uncache: Yes, dependency: None
[01B4:0E6C][2017-09-20T06:30:54]i305: Verified acquired payload: Chrome at path: C:\ProgramData\Package Cache\.unverified\Chrome, moving to: C:\ProgramData\Package Cache\9102865AE2381BC34E91C107DA5818CF971356E8\ChromeStandaloneSetup64-v51.0.2704.103.exe.
[01B4:0F1C][2017-09-20T06:31:19]i301: Applying execute package: Chrome, action: Uninstall, path: C:\ProgramData\Package Cache\9102865AE2381BC34E91C107DA5818CF971356E8\ChromeStandaloneSetup64-v51.0.2704.103.exe, arguments: '"C:\ProgramData\Package Cache\9102865AE2381BC34E91C107DA5818CF971356E8\ChromeStandaloneSetup64-v51.0.2704.103.exe"'
[0910:0794][2017-09-20T06:31:33]i319: Applied execute package: Chrome, result: 0x0, restart: None
[01B4:0F1C][2017-09-20T06:31:59]i351: Removing cached package: Chrome, from path: C:\ProgramData\Package Cache\9102865AE2381BC34E91C107DA5818CF971356E8\
[0910:0794][2017-09-20T06:32:02]i410: Variable: CHROMEEXISTS = 1
[0910:0794][2017-09-20T06:32:02]i410: Variable: CHROMEVERSION = 51.0.2704.103
[0910:0794][2017-09-20T06:32:02]i410: Variable: WixBundleLog_Chrome = C:\Users\User\AppData\Local\Temp\MyProgram_20170920063033_2_Chrome.log
[0910:0794][2017-09-20T06:32:02]i410: Variable: WixBundleRollbackLog_Chrome = C:\Users\User\AppData\Local\Temp\MyProgram_20170920063033_2_Chrome_rollback.log

Thanks in advance for your help.

1
For InstallCondition: If the condition evaluates to false and the bundle is being installed, repaired, or modified, the package will be uninstalled. That means it should be trying to uninstall the package, but no uninstall command is given. I would imagine that means the bundle is executing the installer with some parameters that the installer is ignoring. Try adding an UninstallCommand with whatever parameters are necessary to remove ChromeStandaloneSetup64-v51.0.2704.103.exe (if that's even possible).philselmer
Actually, I think you can just remove InstallCondition as the bundle will only install the package if DetectCondition evaluates to false (or is omitted). "Burn uses this condition to determine how to treat this package during a bundle action; for example, if this condition is false or omitted and the bundle is being installed, Burn will install this package."philselmer
Thank you philselmer. Removing the InstallCondition did work. I marked Brian Sutherland's answer as correct since he wrote is as an answer. Thanks for responding.Scottlysan

1 Answers

6
votes

The issue is being caused by the InstallCondition on your ExePackage

A condition to evaluate before installing the package. The package will only be installed if the condition evaluates to true. If the condition evaluates to false and the bundle is being installed, repaired, or modified, the package will be uninstalled.

In your logs you can see that the DetectCondition is properly being evaluated as "True" so the bundle does detect the right version of Chrome is installed.

However the InstallCondition is being evaluated to false

[0910:0794][2017-09-20T06:30:34]i052: Condition '(NOT CHROMEEXISTS) OR (NOT CHROMEVERSION="51.0.2704.103")' evaluates to false.

This causes this plan line to show up

[0910:0794][2017-09-20T06:30:34]i201: Planned package: Chrome, state: Present, default requested: Absent, ba requested: Absent, execute: Uninstall, rollback: Install, cache: Yes, uncache: Yes, dependency: None

The install condition I think is supposed to be used in cases where you can selectively install things based on what is already on the system or what was selected to be installed during the UI portion of the bootstrapper. ie: you can use this ExePackage if another program is already present otherwise don't install it (and uninstall it if that other program is no longer present). You would then use the install condition in this case but normally it is not useful to define the install condition.

The old answer below does not apply to the question but it can still be useful to someone with version comparison conditions so I'll leave it


Version comparison in a condition should be

CHROMEVERSION gt;= v51.0.2704.103

The v infront of the version tells wix to evaluate the condition as two version variables. All RegistrySearch variables are String variables and the comparison between the variables in your condition gets evaluated based on the format of the variables themselves. Since the registry search is always a string, the other operand in the expression determines what type of comparison happens.