Wix condition for Feature - wix

I have two Features in my Wix file
AppServer
Online
AppServer feature gets installed by default, Online should get install only if SQL Server 2012 express installation exists on box. For that I'm doing search in the registry to get SQL Server version.
Registry Search:
<Property Id="SQLSERVER_INSTANCE" Secure="yes">
<RegistrySearch Id="SQLServerRegSearch" Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft Sql Server\Instance Names\SQL" Type="raw" Name="MSSQLSERVER" />
</Property>
<Feature Id="Online" ConfigurableDirectory="INSTALLDIR" Level="10" Description="Online" Title="Online Platform">
<Condition Level="0">SQLSERVER_INSTANCE <> "MSSQL11.MSSQLSERVER"</Condition>
<ComponentRef Id="CompConfig" />
</Feature>
Problem:
Even if the box is not having SQL Server 2012 Online Feature is getting installed, Also is it possible to show message if sql server is not found.
Looks like I'm missing something, Please help me.
Thanks

Related

How to check if SQL Server 2012 Express edition is installed or not in wix toolset?

How to check if SQL Server 2012 Express edition is installed or not in Wix toolset installation?
<Property Id="SQLSERVER">
<RegistrySearch Id="SQLServer" Root="HKLM"
Key="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.SQLEXPRESS"
Win64="yes" Type="raw" Name="InstalledInstances"/>
</Property>
<Condition Message="You don't have SQL Server installed.">
<![CDATA[SQLSERVER >< SQLEXPRESS]]>
</Condition>
I think the comparison operator should be <> and not >< .
<![CDATA[SQLSERVER <> "SQLEXPRESS"]]>
You can check expression-syntax from wix site.

How can I put a condition on a feature that disables it (instead of hiding it)?

How can I have a Feature depend on a system dependency (e.g. powershell), but still indicate to users that this feature is available in the installer.
Currently features are listed as follows (screenshot):
Feature List
My current idea is to put a condition on the feature:
<Property Id="POWERSHELL_3_INSTALLED">
<RegistrySearch Id="Powershell3Installed"
Root="HKLM"
Key="SOFTWARE\Microsoft\PowerShell\3"
Type="raw"
Name="Install" />
</Property>
<Feature Id="TestFeature"
Title="Test Feature"
Description="Test Feature Description. Note: This feature requires Powershell 3 or higher."
Level="1"
Absent="allow"
InstallDefault="local"
AllowAdvertise="no">
<Condition Level="0">
<![CDATA[(POWERSHELL_3_INSTALLED <> "#1") AND NOT REMOVE]]>
</Condition>
</Feature>
This does hide TestFeature for users without powershell installed, preventing them to install it, but this way users are not aware that this extra feature would be available if they would install powershell.
Any ideas how to achieve this?
The SelectionTree control in Windows Installer does not support showing disabled features. You would have to reimplement that -- for example, using checkboxes.

Wix: Determine if SqlLocalDB is installed

I'm trying to determine is it LocalDb installed and i tried to go the way from this link Determine if SqlLocalDB is installed
But i've got an error on my log file that: Registry key not found. Key = 'SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL12E.LOCALDB\MSSQLServer\CurrentVersion'
My code is:
<util:RegistrySearch Id="SearchForLocalDB"
Root="HKLM"
Key="SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL12E.LOCALDB\MSSQLServer\CurrentVersion"
Value="CurrentVersion"
Variable="LocalDBVersion"
Result="value"/>
<PackageGroup Id="LOCALDB">
<MsiPackage Id="LOCALDB"
DisplayName="Microsoft SQL Server 2014"
Permanent="yes"
Visible="yes"
DisplayInternalUI="yes"
SourceFile=".\SqlLocalDB.msi"
InstallCondition="(LocalDBVersion <= "12.0")"
/>
</PackageGroup>
Use Result='exists' rather than pulling the actual value. You already have the version in the key value so you don't need to check for it in the InstallCondition.

Running a Custom Action on conditions issue

Can anyone tell me why this is not working please?
I have two registry checks to check if Visual C++ Redistributables are installed:
<Property Id="REGDBKEYEXISTX64">
<RegistrySearch Id="REGDBKEYEXISTX64" Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\{837b34e3-7c30-493c-8f6a-2b0f04e2912c}" Name="Version" Type="raw" Win64="yes" />
</Property>
<!--Checking if Microsoft Visual C++ Redistributables are installed on a 32-bit system-->
<Property Id="REGDBKEYEXIST">
<RegistrySearch Id="REGDBKEYEXIST" Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\{837b34e3-7c30-493c-8f6a-2b0f04e2912c}" Name="Version" Type="raw" Win64="no" />
</Property>
I then run a custom action if they are not installed:
<Custom Action="InstallRedistributables" After="GetVariantName">Installed OR REGDBKEYEXISTX64 OR REGDBKEYEXIST</Custom>
However when the redistributables are installed it still runs the custom action which is what i do not want. I know it detects it as this is my log file:
Property: REGDBKEYEXIST, Signature: REGDBKEYEXIST
MSI (c) (4C:44) [12:19:04:989]: PROPERTY CHANGE: Adding REGDBKEYEXIST property. Its value is '#134276921'.
So what could be the problem? I have this done on another custom action and it works perfectly so i really don't know the solution.
It appears your condition is reversed. The REGDBKEYEXIST properties will be set if the registry key exists, and thus true when the search indicates the redistributable is present. So what you probably want is more like NOT REGDBKEYEXIST You also probably only want to run this on first time install (hence your reference to Installed). So I would suggest changing your condition to something more like the following:
NOT(Installed or REGDBKEYEXIST or REGDBKEYEXISTX64)

Registry not being read when using registrysearch in Wix

I have been searching the internet for an answer on this registry search issue.
I have a bigger wix file but i could not get multiple features working and its the conditioning of the features so I have created a basic test wix document to understand the features of wix but can not get the result i required.
The code is as follows:
<Property Id="BASICTEST" Secure="yes" >
<RegistrySearch Id="_Regsearch_Basic" Root="HKLM"
Key="SOFTWARE\TGSL\BasicInstaller" Name="BASIC1" Type="raw" >
</RegistrySearch>
</Property>
<Property Id="BASICTEST1" Secure="yes" >
<RegistrySearch Id="_Regsearch_Test" Root="HKLM"
Key="SOFTWARE\TGSL\BasicInstaller" Name="TEST1" Type="raw" >
</RegistrySearch>
</Property>
<Feature Id="BasicFeature" Title="BasicFeat" Level="0">
<Condition Level="1">NOT (BASICTEST="0")</Condition>
<ComponentRef Id="BasicTest"/>
</Feature>
<Feature Id="TestFeature" Title="TestFeat" Level="0" >
<Condition Level="1">NOT (BASICTEST1="0") </Condition>
<ComponentRef Id="BasicTest1"/>
</Feature>
I have set up four registry entries, all values are 1 (BASIC1=1 and TEST1=1) to test which registry it is using (either 2 in SOFTWARE\TGSL\BasicInstaller for 64bit or 2 in SOFTWARE\TGSL\BasicInstaller for 32bit)
I know it defaults to 32bit unless otherwise stated but still nothing. I was using process monitor to test to see if my .msi file was reading the registry...which it isnt.
I created a log file when installing the .msi and i get a error code when reading the registry:
AppSearch: Property: BARRIETEST, Signature: _Regsearch_BarrieTest1
Note: 1: 2262 2: Signature 3: -2147287038
Note: 1: 1402 2: HKEY_LOCAL_MACHINE32\SOFTWARE\TGSL\BasicInstaller 3: 2
The error code is not finding the file but it looks like it is looking in a directory that doesnt exist and when i change it to win64="yes" it takes away the 32 after the HKEY_LOCAL_MACHINE.
I have tried building this test script in wix 2.0 and it searches the registry fine and it changes the property to the value of the registry key "1" so i am in a quandary as to what im doing wrong??
Is there a difference between the registry search parameters between wix 2.0 and wix 3.5?
Can anyone suggest a possible fix or how i can get these features working?
Please help...thank in advance
For closure, as indicated in the question comments, this was a permissions issue where the user running the setup installer did not have enough privileges to access HKEY_LOCAL_MACHINE.