[wix-users] Burn is Unsetting Variable
Edwin Castro
egcastr at gmail.com
Thu Aug 30 09:30:42 PDT 2018
The registry search is updating the variable with the results of the
search, the empty string, which indicates the target of the search was not
found.
You need to change your condition to
WiXBundleInstalled OR (NOT Installed_Ver) OR (WixBundleFileVersion >
Installed_Ver)
That way, if Installed_Ver is empty, then NOT Installed_Ver will be true.
--
Edwin G. Castro
On Thu, Aug 30, 2018 at 1:31 AM Farrukh Waheed via wix-users <
wix-users at lists.wixtoolset.org> wrote:
> In my Bundle project, I'm searching registry for a version and setting a
> variable:
>
> <Variable Name="Installed_Ver" bal:Overridable="yes" Type="version"
> Value="0.0.0.0" Persisted="yes" />
>
> <util:RegistrySearch
> Id="Self_Ver"
> Root="HKLM"
> Key="Software\MyCompany\MyProductName"
> Value="Version"
> Variable="Installed_Ver"
> Format="raw"
> Win64="yes"
> />
>
> And using this in Condition as:
>
> <util:RegistrySearchRef Id="Self_Ver" />
> <bal:Condition Message="A recent or same version of this product is
> already installed on this machine. Please contact product support for more
> information." >
> <![CDATA[WixBundleInstalled OR (WixBundleFileVersion >
> Installed_Ver)]]>
> </bal:Condition>
>
> This works fine if HKLM\Software\MyCompany\MyProductName\\Version exists.
> But if this registry doesn't exist then registry search would fail and it
> is Unsetting the variable 'Installed_Ver'. This causes the condition
> wrongly evaluating to false.
>
> By defining <Variable>, I tried to set a default value i.e. "0.0.0.0" so it
> should have some value and condition would be evaluated properly i.e. to
> True in this case.
>
> Here is the log, which shows that it is Unsetting the variable
> 'Installed_Ver'.
>
> > [5898:2AC4][2018-08-30T13:15:08]i000: Setting string variable
> 'WixBundleName' to value 'RegVersionCheck'
> [5898:2AC4][2018-08-30T13:15:08]i000: Setting string variable
> 'WixBundleManufacturer' to value 'Testing'
> [5898:3354][2018-08-30T13:15:08]i000: Setting numeric variable
> 'WixStdBALanguageId' to value 1033
> [5898:3354][2018-08-30T13:15:08]i000: Setting version variable
> 'WixBundleFileVersion' to value '7.1.2.3'
> [5898:2AC4][2018-08-30T13:15:08]i100: Detect begin, 1 packages
> [5898:2AC4][2018-08-30T13:15:08]i000: Registry key not found. Key =
> 'Software\MyCompany\MyProductName'
> [5898:2AC4][2018-08-30T13:15:08]i000: ****Unsetting variable
> 'Installed_Ver'****
> [5898:2AC4][2018-08-30T13:15:08]i101: Detected package: MainProduct, state:
> Absent, cached: None
> [5898:2AC4][2018-08-30T13:15:08]i104: Detected package: MainProduct,
> feature: CalculatorFeature, state: Absent
> [5898:2AC4][2018-08-30T13:15:08]i052: Condition 'WixBundleInstalled OR
> (WixBundleFileVersion > Installed_Ver)' evaluates to false.
> [5898:2AC4][2018-08-30T13:15:08]e000: A recent or same version of this
> product is already installed on this machine. Please contact product
> support for more information.
> [5898:2AC4][2018-08-30T13:15:08]e000: Error 0x81f40001: Bundle condition
> evaluated to false: WixBundleInstalled OR (WixBundleFileVersion >
> Installed_Ver)
> [5898:2AC4][2018-08-30T13:15:08]i199: Detect complete, result: 0x0
>
> I tried by hard-coding "0.0.0.0" in the condition and it works fine.
>
> ***How should I get a default value for Installed_Ver if registry search
> fails?***
>
> Thanks
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>
More information about the wix-users
mailing list