I'm trying to configure an installer to conditionally install certain components only when certain versions of a 3rd party application are installed.
<EDIT>
It should be noted there is a 1:1 correspondence between the 3rd party software version and ours.. are there are dozens of such releases of the 3rd party software (plus up to three additional releases each month), so we do not want to be performing hand editing. Our programs are automatically built against all releases of the 3rd party software, but which files get installed needs to occur conditionally.
<\EDIT>
I'm only deploying this as a single .MSI, so no Bootstrapper etc. From my readings and googlings, I believe that I need to have an UPGRADE section, to identify what PRODUCTCODE the application will currently have (multiple versions.. so there are multiple PRODUCTCODEs possible). This PRODUCTCODE can then be used to read the DisplayVersion out of the registry.
So I have:
<Upgrade Id="{6D991503-3102-437E-B21D-471599D491AB}">
<UpgradeVersion Minimum="0.0.0.0" OnlyDetect="yes" Property="CLEARSCADADETECTED" />
</Upgrade>
for the UPGRADE section, and then..
<Property Id="CLEARSCADA_VER" Secure="yes" Hidden="no" Value="6.78.6626.1">
<RegistrySearch Id="ClearSCADAVersionSearch"
Root="HKLM"
Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\[CLEARSCADADETECTED]"
Name="DisplayVersion"
Type="raw"
Win64="yes" />
</Property>
For the REGISTRYSEARCH.
It seems that the PRODUCTCODE lookup is working, however the Registrysearch isn't.. (I'm expecting a PROPERTY CHANGE entry after the AppSearch)
FindRelatedProducts: Found application: {2ACE38B2-F142-4EFE-9AC7-B25514E4930E}
MSI (c) (F0:90) [23:17:39:598]: PROPERTY CHANGE: Adding CLEARSCADADETECTED property. Its value is '{2ACE38B2-F142-4EFE-9AC7-B25514E4930E}'.
Action ended 23:17:39: FindRelatedProducts. Return value 1.
...
AppSearch: Property: CLEARSCADA_VER, Signature: ClearSCADAVersionSearch
MSI (c) (F0:90) [23:17:39:629]: Note: 1: 2262 2: Signature 3: -2147287038
Action ended 23:17:39: AppSearch. Return value 1.
I've tried hardcoding the registry lookup (i.e. replacing the [CLEARSCADADETECTED] by static text of {2ACE38B2-F142-4EFE-9AC7-B25514E4930E}), without any change. Any other suggestions for what to check would be greatly appreciated.
<EDIT 2>
Ok, confusingly, if I reference the Version DWORD value (instead of the DisplayVersion String value) then it does read it correctly as #105781730.
Is it possible that the RegistrySearch wouldn't work for String values?
<EDIT 2>
<EDIT 3>
Yay... it's working. And I guess it's been working for a while now also.
When I put the Value='6.78.6626.1', I should have realised that if the version that I was testing it on was already '6.78.6626.1' then it wouldn't have indicated a PROPERTY CHANGE.
<EDIT 3>
Bevan
Hidden
attribute will probably hide the set property operation from the log file. See my answer below. Going to test if it works with theValue
attribute specified (I took that one out as well). – Stein Åsmul