Reputation: 11
I'm creating a bundle using WIX. I'm using a util:FileSearch to check if a file exists and I want to install a MsiPackage if that file exists. I'm also checking the processor architecture which works.
Here's the Bundle.wxs:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Bundle Name="My_Setup_2" Version="1.0.0.0" Manufacturer="ABC" UpgradeCode="3945a604-d6ae-4334-8a5b-1e9e2f222e08">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<PackageGroupRef Id="MyInstallx64"/>
</Chain>
</Bundle>
<Fragment>
<util:FileSearch Id="Outlook2013Search"
Variable="Outlook2013Exists"
Result="exists"
Path="[ProgramFilesFolder]Microsoft Office\Office15\OUTLOOK.EXE"/>
<PackageGroup Id="MyInstallx64">
<MsiPackage
SourceFile="MyInstallx64.msi"
InstallCondition="ProcessorArchitecture = 9 AND Outlook2013Exists = true" Visible="yes" >
</MsiPackage>
</PackageGroup>
</Fragment>
</Wix>
What do I put in the InstallCondition so that the msi only installs if this file exists? I tried "Outlook2013Exists = true" but this does not work.
Upvotes: 1
Views: 4013
Reputation: 20780
You might be better off using a WiX util component id search, such as in this question:
What Component IDs should I search for to detect whether the Office 2010 PIA's are Installed
where there are references to other Office versions also. Also this post:
Without knowing what your MSI product does, you may need top worry that there are 64- and 32-bit versions of Office, so the file locations may be ProgramFiles or ProgramFiles(x86) depending on the version and assuming it's installed there in the first place. If you are installing an add-in you may need to provide support for both bitness versions of Office.
Upvotes: 0
Reputation: 4798
You probably shouldn't be doing an installCondition based off of a file search. A few issues that can arise from this,
The best option for a installCondition is to check a registry key. Generally all the registry keys will be in the same path HKLM\SOFTWARE\Microsoft\Office\15.0\Common\ProductVersion and also check that HKLM\SOFTWARE\Microsoft\Office\15.0\Outlook exists
So as an example you could do
<util:RegistrySearch
Id="Office15Installed_x64"
Win64="yes"
Root="HKLM"
Key="SOFTWARE\Microsoft\Office\15.0\Common"
Value="ProductVersion"
Result="value"
Variable="Office15Installed_x64" />
<util:RegistrySearch
Id="Outlook15Bitness_x64"
Win64="yes"
Root="HKLM"
Key="SOFTWARE\Microsoft\Office\15.0\Outlook"
Value="Bitness"
Result="value"
Variable="Outlook15Bitness_x64" />
You can also find the install path in "Common\InstallRoot"
Then you would use a Installcondition like this
InstallCondition="Office15Installed_x64 AND Outlook15Bitness_x64 ~= "x64""
I only have 32-bit installed on my machine right now so you would have to look through the registry of a machine with Outlook 64-bit installed to see the correct values to use.
If you want to use the file search result as the install condition, you just have to use
InstallCondition="ProcessorArchitecture = 9 AND Outlook2013Exists"
IIRC, the file search creates a property and sets it to 1 or 0 depending on whether or not the file was found. In a condition, 1 is treated as truthy and 0 is false.
Additionally, take a look at the bootstrapper log after running. This is very useful as it can show you property values and the evaluation result of the conditions in the install.
Upvotes: 2