Wix: Determine if SqlLocalDB is installed - wix

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.

Related

WiX bundle RegistrySearch always fails

I am trying to use a registry search in a WiX bundle to detect if the Microsoft Access Database Engine is installed and then conditionally install it based on the result:
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Office\14.0\Access Connectivity Engine" Result="exists" Variable="AccessDbInstalled" />
<PackageGroup Id="AccessDb">
<ExePackage
Id="AccessDb14"
Cache="no"
Compressed="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile="Prereqs\AccessDatabaseEngine_X64.exe"
InstallCommand="/quiet /norestart"
InstallCondition="NOT AccessDbInstalled">
</ExePackage>
</PackageGroup>
However the log shows the registry search as always failing, even though I can plainly see the key in the registry:
[77E4:51D8][2021-10-14T16:45:11]i000: Registry key not found. Key = 'SOFTWARE\Microsoft\Office\14.0\Access Connectivity Engine'
[77E4:51D8][2021-10-14T16:45:11]i000: Setting numeric variable 'AccessDbInstalled' to value 0
I have other registry searches that work fine, just not this one?!
Add Win64="yes". The search defaults to the 32-bit registry hive. You need to tell Burn you want the 64-bit registry.

SQL Express 2014 instance not removed on uninstall

I am trying to set up an installation, with sql express 2014 as a prerequisite. The installation itself works fine, but when uninstalling, the instance is not removed. I can still access it through my sql manager and find it in the registry.
This is my Chain:
<Chain>
<ExePackage
Id="Netfx4Full"
Name="dotNetFx40_Full_x86_x64.exe"
Cache="no"
Compressed="no"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile="packages\dotNetFx40_Full_x86_x64.exe"
DownloadUrl="https://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe"
DetectCondition="Net4FullVersion AND (NOT VersionNT64 OR Net4x64FullVersion)"
InstallCondition="(VersionNT < v6.0 OR VersionNT64 < v6.0) AND (NOT (Net4FullVersion OR Net4x64FullVersion))">
</ExePackage>
<PackageGroupRef Id="Sql2014Express"/>
<RollbackBoundary />
<MsiPackage Id="MainPackage" SourceFile="MyApplication.msi" DisplayInternalUI="yes" Compressed="yes" Vital="yes" />
</Chain>
This is my ExePackage:
<PackageGroup Id="Sql2014Express">
<ExePackage Id="SQL2014Expressx64"
InstallCondition="VersionNT64 AND NOT SQL2014x64InstanceInstalled"
SourceFile="packages\SQLEXPR_x64_ENU.exe"
DownloadUrl="$(var.SqlWebLink64)"
DisplayName="Installing Microsoft SQL Express 2014"
InstallCommand="/ACTION=Install /INSTANCENAME=$(var.InstanceName) /FEATURES=SQLENGINE /Q /HIDECONSOLE /SkipRules=RebootRequiredCheck /IAcceptSQLServerLicenseTerms /SQLSVCSTARTUPTYPE=Automatic /SQLSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" /AGTSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" /ASSYSADMINACCOUNTS=BUILTIN\Administrators /SQLSYSADMINACCOUNTS=BUILTIN\Administrators /BROWSERSVCSTARTUPTYPE=Disabled /ADDCURRENTUSERASSQLADMIN=true /TCPENABLED=1"
UninstallCommand="/Action=Uninstall /INSTANCENAME=$(var.InstanceName) /FEATURES=SQLENGINE /Q /HIDECONSOLE"
Cache="yes"
Vital="yes"
Compressed="no"
PerMachine="yes"
Permanent="no"/>
...
</PackageGroup>
From what i understand, the Permanent="no", should take care of removing the package on uninstall. I have even included and UninstallCommand, but this does not remove the instance either.
What am I missing here?
Let me know if any other info is required to solve this. - Thx!
Exe packages require a DetectCondition to be able to verify whether or not the package is installed. If you notice in your .net exepackage you have
DetectCondition="Net4FullVersion AND (NOT VersionNT64 OR Net4x64FullVersion)"
This tells the installer that this package is installed iff the condition is true. You have to do the same thing in your SQL exe package.
DetectCondition is
A condition that determines if the package is present on the target system. This condition can use built-in variables and variables returned by searches. This condition is necessary because Windows doesn't provide a method to detect the presence of an ExePackage. Burn uses this condition to determine how to treat this package during a bundle action; for example, if this condition is false or omitted and the bundle is being installed, Burn will install this package.
You can do this by creating some registry searches which set some variables. Try this registry search
<util:RegistrySearch
Id='MicrosoftSQLInstalledCheck'
Root='HKLM'
Key='SOFTWARE\Microsoft\Microsoft SQL Server\$(var.InstanceName)\Setup'
Win64='yes'
Value='SQLPath'
Result='exists'
Variable='MicrosoftSQLInstalled'/>
Then in your ExePackage for SQL you can put DetectCondition="MicrosoftSQLInstalled" and that will be true if the registry search found the SQLPath registry entry in the key specified.

Quicktime is installing when it is already installed

I have a WIX installer bundle that has QuickTime as a prereq. I trying to check a registry key to determine if it's already installed but it always comes back false.
The log shows...
[08B4:040C][2015-07-06T10:50:14]i000: Registry key not found. Key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Media\QuickTime'
[08B4:040C][2015-07-06T10:50:14]i000: Setting numeric variable 'QuickTimeFound64' to value 0
[08B4:040C][2015-07-06T10:50:14]i000: Registry key not found. Key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Media\QuickTime'
The registry is ...
The code is ...
<util:RegistrySearch Root="HKLM" Key="HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Media\QuickTime" Result="exists" Variable="QuickTimeFound64" Win64="yes" />
<util:RegistrySearch Root="HKLM" Key="HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Media\QuickTime" Result="exists" Variable="QuickTimeFound32" Win64="no" />
<Chain>
<PackageGroupRef Id="PackageGroup_NetFx35Redist"/>
<PackageGroupRef Id="PackageGroup_NetFx40Redist"/>
<PackageGroupRef Id="PackageGroup_SQLServer2012"/>
<ExePackage Id="Package_QuickTime" Cache="no" Compressed="$(var.Compressed)"
Description="Apple QuickTime 7" DownloadUrl="$(var.GuruDownloadRepo)/{2}"
SourceFile="..\Prerequisites\QuickTimeInstaller.exe"
Name="Prerequisites\QuickTimeInstaller.exe"
Permanent="yes" DisplayName="Apple QuickTime 7"
DetectCondition="QuickTimeFound64 AND QuickTimeFound32" />
I have tried including "Wow6432Node" in the 64bit path but it didn't make any difference.
Can anyone tell me why both of the searches are coming back as false?
Use
SOFTWARE\Clients\Media\QuickTime
instead of
HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Media\QuickTime
because HKEY_LOCAL_MACHINE is specified in the Root attribute.

How to get DefaultInstance when bootstrapping SQL Server 2005 Express

I'm able to install SQL Server 2005 Express with the bootstrapper, but I can't seem to be able to install the default instance.
I have tried
<Property Id="SQLInstance" Value="MSSQLSERVER" />
<ExePackage Id="SQL2005Express" DisplayName="SQL Server 2005 EXPRESS" Cache="yes" Compressed="yes"
InstallCondition="not SqlInstanceKeyFound"
DetectCondition="SqlInstanceKeyFound"
PerMachine="yes" Permanent="yes" Vital="yes" Name="SQLEXPR.EXE" SourceFile="$(var.ThirdToolsSrc)\SQLEXPR.EXE"
InstallCommand="/qn ADDLOCAL=All SECURITYMODE=SQL [SqlVariable] DISABLENETWORKPROTOCOLS=0 INSTANCENAME=[SQLInstance]">
<ExitCode Value ="3010" Behavior="forceReboot" />
</ExePackage>
This will create an instance [MACHINENAME]\SQLEXPRESS, I tried without specifying the InstanceName parameter but got the same result.
Looking at this page, I don't see what I can change to be able to add the default instance.
I want to have the DefaultInstance to be [MachineName] only
Thanks.
Finally, I figured what was causing the problem, event though it seems a bit weird to me, but I was able to get the required result.
ORIGINAL CODE
<ExePackage Id="SQL2005Express" DisplayName="SQL Server 2005 EXPRESS" Cache="yes" Compressed="yes"
InstallCondition="not SqlInstanceKeyFound"
DetectCondition="SqlInstanceKeyFound"
PerMachine="yes" Permanent="yes" Vital="yes" Name="SQLEXPR.EXE" SourceFile="$(var.ThirdToolsSrc)\SQLEXPR.EXE"
InstallCommand="/qn ADDLOCAL=All SECURITYMODE=SQL [SqlVariable] DISABLENETWORKPROTOCOLS=0 INSTANCENAME=[SQLInstance]">
MODIFIED CODE (Working)
I didnèt think that the order of the parameters were important , but it seems that they are.

Wix condition for Feature

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