WiX bundle RegistrySearch always fails - wix

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.

Related

Wix bootstrapper and trying to install an exe that has multiple files

I am trying to get Wix to install https://www.silabs.com/documents/public/software/CP210x_Windows_Drivers.zip
It is basically an exe that has multiple files and folders that are required for the installation to work.
I have added this this to Bundle.wxs in the Bootstrapper.
<Fragment>
<PackageGroup Id="WindowsCP210xVCPInstallerx64" >
<ExePackage
Id="WindowsCP210xVCPInstallerx64"
Name="$(var.PackagePath)\CP210xVCPInstaller_x64.exe"
DisplayName="CP210x USB to UART Bridge Virtual COM Port (VCP) drivers"
Cache="no"
Compressed="no"
PerMachine="yes"
Permanent="yes"
InstallCondition="VersionNT64"
InstallCommand="/Q /SW /SE"
RepairCommand="/Q /SW /SE"
UninstallCommand="/U $(var.PackagePath)\CP210x_VCP_Windows\slabvcp.inf /Q"
SourceFile="CP210xVCPInstaller_x64.exe">
</ExePackage>
</PackageGroup>
</Fragment>
However when building I keep getting this error
The system cannot find the file 'CP210xVCPInstaller_x64.exe'.
At present I have just added the entire folder that contains the CP210xVCPInstaller_x64.exe and all the other files it depends on into the project.

.NET 4.5.2 conditions in a Wix bundle

I'm working on a Wix project to learn more about Wix. I'm trying to configure my Wix bundle to detect and install .NET 4.5.2 but I'm a little confused. I've seen a lot of examples where the registry is checked but I wanted to know if I can do something like this:
<Chain>
<PackageGroupRef Id="NetFx452Redist" />
<ExePackage Id="Netfx452"
Cache="no"
Compressed="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
InstallCommand="/q /norestart"
SourceFile="$(var.ProjectDir)Resources\NDP452-KB2901907-x86-x64-AllOS-ENU.exe"
DetectCondition="NetFx452"
InstallCondition="NOT NetFx452" />
<MsiPackage Id="ShittyMsi"
SourceFile="$(var.MyInstaller.TargetDir)"
Name="$(var.MyInstaller.TargetFileName)" />
</Chain>
If I can't do this and I need to check the registry, how do I know what I need to be looking for in the registry?
You're already using <PackageGroupRef Id="NetFx452Redist" /> so you don't need to check the registry; the package group already takes care of checking the registry and setting the right attributes.

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.

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.