2
votes

I want my install to fail if a previous version of the application is already installed.

I am trying to search the UpgradeCode in RegEdit file. The Value Name of the Upgrade Code is "BundleUpgradeCode". However even if there is no entry in regedit the log for the Bootstrap returns condition value as true. I am not sure what is going wrong.

    <util:RegistrySearchRef Id="SearchForInstaller" />

    <util:RegistrySearch Id="VSTORuntimeTest" Root="HKLM" Key="SOFTWARE\Microsoft\VSTO Runtime Setup\v4R\" Value="VSTORFeature_CLR40" Variable="VSTORFeature"/>
    <util:RegistrySearch Id="VSTORuntimeVersionV4R" Root="HKLM" Key="SOFTWARE\Microsoft\VSTO Runtime Setup\v4R\" Value="Version" Variable="VSTORVersionV4R"/>
    <util:RegistrySearch Id="VSTORuntimeVersionV4" Root="HKLM" Key="SOFTWARE\Microsoft\VSTO Runtime Setup\v4R\" Value="Version" Variable="VSTORVersionV4"/>

    <util:RegistrySearch Id="DotNetTest" Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Client" Value="Install" Variable="DotNetInstall"/>
    <util:RegistrySearch Id="DotNetVersion" Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Client" Value="Version" Variable="DotNetVersion"/>

    <Chain>
        <ExePackage Id="dotNetFx40_Client_x86_x64" SourceFile="$(var.PreReqPath)\DotNetFX40Client\dotNetFx40_Client_x86_x64.exe" PerMachine="yes" Cache="no"
                    Compressed="no"
                    DownloadUrl="http://download.microsoft.com/download/7/B/6/7B629E05-399A-4A92-B5BC-484C74B5124B/dotNetFx40_Client_setup.exe"
                    Permanent="yes"
                    InstallCommand="/q /norestart"
                    DetectCondition="NOT DotNetInstall"
                    InstallCondition="NOT DotNetInstall OR NOT (DotNetVersion >=v4.0.30319)" />

        <ExePackage Id="VSTORuntime" SourceFile="$(var.PreReqPath)\VSTOR40\vstor_redist.exe" Permanent="yes" Vital="yes" Cache="no" Compressed="no"
                    DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=158917"
                    PerMachine="yes"
                    InstallCommand="/q /norestart"
                    DetectCondition="VSTORFeature"
                    InstallCondition="NOT VSTORFeature OR NOT (VSTORVersionV4R >=v10.0.40303) OR NOT (VSTORVersionV4 >=v10.0.21022)" />

        <MsiPackage SourceFile="$(var.AEMSetup.TargetPath)" Vital="yes" Compressed="no" Id="WordAddIns" DisplayInternalUI="yes"/>
    </Chain>
</Bundle>
<Fragment>
    <util:RegistrySearch Id="SearchForInstaller"  Variable ="BundleUpgradeCode" Root="HKLM" Key="SOFTWARE\Wow6432Node\Microsoft\Windows" Result="exists"  />

    <bal:Condition Message="Another version of this product is already installed. Installation of version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs in Control Panel." >BundleUpgradeCode</bal:Condition>

</Fragment>

[0E98:0390][2013-06-18T13:22:49]i000: Setting string variable 'WixBundleName' to value 'Avanade Estimation Model - v3.4.3' [0E98:0390][2013-06-18T13:22:49]i100: Detect begin, 3 packages [0E98:0390][2013-06-18T13:22:49]i000: Setting string variable 'DotNetInstall' to value '1' [0E98:0390][2013-06-18T13:22:49]i000: Setting string variable 'DotNetVersion' to value '4.5.50709' [0E98:0390][2013-06-18T13:22:49]i000: Setting numeric variable 'BundleUpgradeCode' to value 1 [0E98:0390][2013-06-18T13:22:49]i000: Setting string variable 'VSTORFeature' to value '1' [0E98:0390][2013-06-18T13:22:49]i000: Setting string variable 'VSTORVersionV4' to value '10.0.40303' [0E98:0390][2013-06-18T13:22:49]i000: Setting string variable 'VSTORVersionV4R' to value '10.0.40303' [0E98:0390][2013-06-18T13:22:49]i102: Detected related bundle: {4edb6855-8f5b-438b-9a6b-4598e7083cd7}, type: Upgrade, scope: PerMachine, version: 3.4.2.0, operation: MajorUpgrade [0E98:0390][2013-06-18T13:22:49]i052: Condition 'NOT DotNetInstall' evaluates to false. [0E98:0390][2013-06-18T13:22:49]i052: Condition 'VSTORFeature' evaluates to true. [0E98:0390][2013-06-18T13:22:49]i101: Detected package: dotNetFx40_Client_x86_x64, state: Absent, cached: None [0E98:0390][2013-06-18T13:22:49]i101: Detected package: VSTORuntime, state: Present, cached: None [0E98:0390][2013-06-18T13:22:49]i101: Detected package: WordAddIns, state: Present, cached: Complete [0E98:0390][2013-06-18T13:22:49]i052: Condition 'BundleUpgradeCode' evaluates to true. [0E98:0390][2013-06-18T13:22:49]i199: Detect complete, result: 0x0

Any help would be appreciated. Thanks in Advance.

2

2 Answers

1
votes

BundleUpgradeCode variable returns 1 from the RegistrySearch, if the registry entry is available. As per my understood we can consider previous version is installed, if the registry entry is available. In that case you need to set

(BundleUpgradeCode=0) or Not (BundleUpgradeCode=1)

to evaluate the condition false. So that the installer will fails and show the Condition message.

<bal:Condition Message="Another version of this product is already installed. Installation of version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs in Control Panel." >Not (BundleUpgradeCode=1)</bal:Condition>

I suspect your registry search condition is not correct. Why you used the Wow6432Node, since the RegistrySearch has the attribute “Win64”

0
votes

Try Searching for SOFTWARE\Microsoft\Windows Instead of SOFTWARE\Wow6432Node\Microsoft\Windows. You need not to give WOW6432Node in this case