How to check in WiX (Product.wxs) if Office is installed in version 2010, 2013, 2016, 2019 or later? 2007, 2003 or older should be ignored (as if Office is not installed at all).
I'm aware of this question: C#: How to know whether certain Office 2003 or 2007 application is installed?, but don't know how to check and combine multiple conditions in WiX. I totally can't come up with anything beyond what's in the above question...
Thank you in advance.
You can use a registry search like shown in the following snippet:
<Property Id="OFFICEPATH">
<RegistrySearch Id="OfficeReg" Root="HKLM" Key="SOFTWARE\Microsoft\Office\14.0\Common\InstallRoot" Name="Path" Type="raw" />
</Property>
<Condition Message="This application requires Microsoft Office 2010. Please install Office then run this installer again.">
<![CDATA[Installed OR (OFFICEPATH)]]>
</Condition>
Also you may consider using the Windows Installer
APIs to find out if the relevant product/package/component codes are present on the machine. These can be done via P/Invoke calls.
Everything depends on which Office editions you need to support. There are Click2Run
editions of MS Office that don't add the usual or necessary windows registry keys. In that case you need to have a special case for that, for example, if your add-in is for Outlook, you could check the following path in the windows registry:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\15.0\Common\InstallRoot\Virtual\VirtualOutlook
Read more about that in the Determine whether Outlook is a Click-to-Run application on a computer