Chain dependant msi packages with burn - wix

I have been struggling now for a few hours getting this working without any real success. I am trying to install ReportViewer 2012 (v11) including SQLSysClrTypes.msi with my installer.
My registry checks are as follow and seems to work:
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Microsoft\Microsoft SQL Server 2012 Redist\SQL Server System CLR Types\CurrentVersion"
Value="Version"
Variable="SQLSysClrTypesVerion" />
<util:RegistrySearch Root="HKLM"
Key="Software\Microsoft\Microsoft SQL Server 2012 Redist\Microsoft Report Viewer 2012 Runtime"
Value="Version"
Variable="ReportViewer11Verion" />
The package ref is as follow:
<PackageGroup Id="ReportViewer11">
<ExePackage Id="SQLSysClrTypes" Cache="no" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes"
SourceFile="reportviewer/SQLSysClrTypes.msi"
DownloadUrl="http://go.microsoft.com/fwlink/?LinkID=239643&quote;clcid=0x409"
DetectCondition="SQLSysClrTypesVerion" />
<ExePackage Id="ReportViewer11" Cache="no" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes"
InstallCommand="/q"
SourceFile="reportviewer/ReportViewer.msi"
DownloadUrl="http://www.microsoft.com/en-us/download/details.aspx?id=35747"
DetectCondition="ReportViewer11Verion" />
</PackageGroup>
The log file for the installer states the following (not really helpful):
[0F08:10E0][2015-04-20T16:47:00]i304: Verified existing payload: ReportViewer11 at path: C:\ProgramData\Package Cache\54004C9B82D761A9AEB4EB73B85F5475D3771BAE\ReportViewer.msi.
[0F08:10E0][2015-04-20T16:47:00]i304: Verified existing payload: InstallationPackageId at path: C:\ProgramData\Package Cache{A327D350-C9A6-4AA5-AA86-92E3B6653E77}v1.0.0.0\Avis.RAC.DARA.msi.
[0F08:04A4][2015-04-20T16:47:00]i301: Applying execute package: ReportViewer11, action: Install, path: C:\ProgramData\Package Cache\54004C9B82D761A9AEB4EB73B85F5475D3771BAE\ReportViewer.msi, arguments: '"C:\ProgramData\Package Cache\54004C9B82D761A9AEB4EB73B85F5475D3771BAE\ReportViewer.msi" /q'
[0F08:04A4][2015-04-20T16:47:00]e000: Error 0x800700c1: Failed to CreateProcess on path: C:\ProgramData\Package Cache\54004C9B82D761A9AEB4EB73B85F5475D3771BAE\ReportViewer.msi
[0F08:04A4][2015-04-20T16:47:00]e000: Error 0x800700c1: Failed to execute EXE package.
[0E24:1164][2015-04-20T16:47:00]e000: Error 0x800700c1: Failed to configure per-machine EXE package.
[0E24:1164][2015-04-20T16:47:00]i319: Applied execute package: ReportViewer11, result: 0x800700c1, restart: None
[0E24:1164][2015-04-20T16:47:00]e000: Error 0x800700c1: Failed to execute EXE package.

You are using ExePackage for your msi files, use MsiPackage instead.

Related

WiX installer fails to uninstall MSI package Error 0x80070643

I have used the WiX toolkit to create an installer. The installer bundle.wxs file has 4 msi packages that I am installing sequentially. Here's the code for the bundle.wxs :
<chain>
<MsiPackage Id="MSOLEDBSQLDriver"
SourceFile="..\..\..\..\..\..\third-party\MSOLEDBSQL\msoledbsql.msi"
DisplayInternalUI="no"
Compressed="yes"
Vital="yes"
ForcePerMachine="yes">
<MsiProperty Name="IACCEPTMSOLEDBSQLLICENSETERMS" Value="YES" />
<MsiProperty Name="ACCEPTEULA" Value="1" />
</MsiPackage>
<MsiPackage Id="MSODBCSQL"
SourceFile="..\..\..\..\..\..\third-party\SQL Server Express\msodbcsql.msi"
DisplayInternalUI="no"
Compressed="yes"
Vital="yes"
ForcePerMachine="yes">
<MsiProperty Name="IACCEPTMSODBCSQLLICENSETERMS" Value="YES" />
<MsiProperty Name="ACCEPTEULA" Value="1" />
</MsiPackage>
<MsiPackage Id="MSSQLCMDLNUTILS"
SourceFile="..\..\..\..\..\..\third-party\SQL Server Express\MsSqlCmdLnUtils.msi"
DisplayInternalUI="no"
Compressed="yes"
Vital="yes"
ForcePerMachine="yes">
<MsiProperty Name="IACCEPTMSSQLCMDLNUTILSLICENSETERMS" Value="YES" />
<MsiProperty Name="ACCEPTEULA" Value="1" />
</MsiPackage>
<RollbackBoundary />
<MsiPackage Id="MainPackage"
SourceFile="..\Application\bin\Release\ApplicationInstaller.msi"
DisplayInternalUI="yes"
Compressed="yes"
Vital="yes">
<MsiProperty Name="INSTALLDIR" Value="CSNode" />
<MsiProperty Name="CONFIGFILE" Value="[CONFIGFILE]"/>
<MsiProperty Name="AddDesktopShortcut" Value="[AddDesktopShortcutMsiVariable]" />
</MsiPackage>
</Chain>
The installation goes well without any issues, however when I try to uninstall the application from program and features, I get a setup failed message with the following log in my Temp folder :
[1C78:092C][2022-03-16T13:38:45]i326: Removed dependency: {7dd16205-28b8-46f2-bc9f-b85e6a7b0525} on package provider: {EDA3FABE-E481-4E69-A7B0-E845DF0FEC22}, package MSSQLCMDLNUTILS
[1C78:092C][2022-03-16T13:38:45]i329: Removed package dependency provider: {EDA3FABE-E481-4E69-A7B0-E845DF0FEC22}, package: MSSQLCMDLNUTILS
[1C78:092C][2022-03-16T13:38:45]i301: Applying execute package: MSSQLCMDLNUTILS, action: Uninstall, path: (null), arguments: ' ALLUSERS="1" ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7" IACCEPTMSSQLCMDLNUTILSLICENSETERMS="YES" ACCEPTEULA="1"'
[1C78:092C][2022-03-16T13:38:45]e000: Error 0x80070643: Failed to uninstall MSI package.
[1C78:092C][2022-03-16T13:38:45]e000: Error 0x80070643: Failed to execute MSI package.
[139C:1398][2022-03-16T13:38:45]e000: Error 0x80070643: Failed to configure per-machine MSI package.
[139C:1398][2022-03-16T13:38:45]i319: Applied execute package: MSSQLCMDLNUTILS, result: 0x80070643, restart: None
[139C:1398][2022-03-16T13:38:45]e000: Error 0x80070643: Failed to execute MSI package.
[1C78:092C][2022-03-16T13:38:45]i318: Skipped rollback of package: MSSQLCMDLNUTILS, action: Install, already: Present
[139C:1398][2022-03-16T13:38:45]i319: Applied rollback package: MSSQLCMDLNUTILS, result: 0x0, restart: None
[1C78:092C][2022-03-16T13:38:45]i323: Registering package dependency provider: {EDA3FABE-E481-4E69-A7B0-E845DF0FEC22}, version: 15.0.2000.5, package: MSSQLCMDLNUTILS
[1C78:092C][2022-03-16T13:38:45]i325: Registering dependency: {7dd16205-28b8-46f2-bc9f-b85e6a7b0525} on package provider: {EDA3FABE-E481-4E69-A7B0-E845DF0FEC22}, package: MSSQLCMDLNUTILS
There are some other questions related to this issue and based on that I added the ForcePerMachine="yes" parameter but that doesn't work either. I have been trying to figure out how to fix that but haven't found a solution which works for me.
Can someone please help me?

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.

WIX Installing the required software with bootstrapper. Error "Extratction failed"

I trying instalation sql server from bootstrapper:
<ExePackage Id="SQL" Name="SqlServer2019" Cache="no" Compressed="no" PerMachine="yes"
Permanent="yes" Vital="yes"
InstallCommand="/ACTION=INSTALL /QS /IACCEPTSQLSERVERLICENSETERMS /SECURITYMODE=SQL /SAPWD=Password1234
/FEATURES=SQLENGINE,REPLICATION,SNAC_SDK /INSTANCENAME=MSSQLSERVER"
SourceFile="C:\Users\admin\Downloads\SQLEXPR_x64_ENU.exe" DetectCondition="SqlStatus = "true""/>
I checked where is problem without parameter "/QS" and on start I had to choose: "Directory For Extracted Files". When I run instalation from console line or run .exe the path:
C:\Users\admin\Downloads\SQLEXPR_x64_ENU\
But if I run this from Bootstrapper path:
C:\ProgramData\Package
Cache\A0086387CD525BE62F4D64AF4654B2F4778BC98D\SqlServer2019\
What throw exception "Extratction failed". How repair this. I dont see I can set this path before instalation.
I would set this path, e.g. "C:\SqlServer2019"
I solved this problem by adding /x:C:\SqlServer2019\ to InstallCommand.

WiX - Does Burn support dual-purpose msi packages?

Does Burn support dual-purpose (per-user or per-machine) MSI packages which were prepared according to these Microsoft guidelines?
I tried to prepare such a package, but it looks like bootstrapper created with Burn doesn't uninstall MSI package, which was installed per-machine after raising UAC privileges by End-User.
The source code for Burn is:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle Version="1.0"
Name="AppNameHere"
UpgradeCode="GuidHere">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense" >
<bal:WixStandardBootstrapperApplication LicenseUrl=""
SuppressOptionsUI="yes"
ThemeFile="Customization\Theme.xml"
LocalizationFile="Customization\LangHere.wxl"/>
</BootstrapperApplicationRef>
<Chain>
<PackageGroupRef Id="WindowsInstaller45"/>
<PackageGroupRef Id="NetFx40ClientRedist"/> <!-- Uzywa rozszerzenia WixNetfxExtension do zainstalowania .net -->
<PackageGroupRef Id="vcredist"/>
<MsiPackage Compressed="yes"
SourceFile="MsiFileNameHere"
DisplayInternalUI="yes">
<MsiProperty Name="UPDATEDIR" Value="[UninstallPath]"/>
<MsiProperty Name="WIXBUNDLEKEY" Value="[WixBundleProviderKey]"/>
</MsiPackage>
</Chain>
</Bundle>
<Fragment>
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x86" Value="Installed" Variable="vcredistkeyx86" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\VC\VCRedist\x86" Value="Installed" Variable="vcredistkeyx64" />
<PackageGroup Id="vcredist">
<ExePackage Id="vcredist_x86"
Cache="no"
Compressed="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile="Components\vcredist_x86.exe"
DetectCondition="(vcredistkeyx86 AND (vcredistkeyx86 >= 1)) OR (vcredistkeyx64 AND (vcredistkeyx64 >= 1))" />
</PackageGroup>
<PackageGroup Id="WindowsInstaller45">
<ExePackage Cache="no"
Compressed="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile="Components\WindowsXP-KB942288-v3-x86.exe"
InstallCondition="VersionNT=v5.1 AND NOT VersionNT64 AND VersionMsi < v4.5"
InstallCommand="/quiet /norestart">
<ExitCode Behavior="forceReboot"/>
</ExePackage>
</PackageGroup>
</Fragment>
</Wix>
As of WIX V3.9 the answer is a qualified "No" - Burn doesn't currently support dual-purpose per-user or per-machine MSI package.
A dual-purpose MSI package has the ALLUSERS property set to "2". When you build a WIX bootstrapper project referencing this type of MSI package you should see this type of warning:
2>D:\Robert\Documents\Visual Studio 2013\Projects\BurnTest\Bootstrapper\Bundle.wxs(18,0): warning LGHT1133: Bundles require a package to be either per-machine or per-user. The MSI 'D:\Robert\Documents\Visual Studio 2013\Projects\BurnTest\SetupProject\bin\Release\SetupProject.msi' ALLUSERS Property is set to '2' which may change from per-user to per-machine at install time. The Bundle will assume the package is per-machine and will not work correctly if that changes. If possible, remove the Property with Id='ALLUSERS' and use Package/#InstallScope attribute instead.
The build process for a WIX bootstrapper project will try and work out from the chained packages what type of burn installation to create (per-user or per-machine). The logic is convoluted because of the different places you can declare a preference for per-user or per-machine, and the potential conflicts between chained packages. But the general idea is the burn compiler will generate a per-machine installation, unless one of the chained packages is per-user, which will flip the burn installation into per-user mode. The key point is the decision to create a per-user or per-machine package is made at build time. To properly support dual-purpose MSI packages that decision would need to be moved to install time.

Wix Burn fails to download exePackage

I am using the exePackage attribute to download an exe pacakge - actually the VSTO runtime from microsoft.
It fails to get the package.
I believe this is the correct way to add it to the CHAIN
<ExePackage Id="VSTORuntime" SourceFile="vstor_redist.exe" Permanent="yes" Vital="yes" Cache="no" Compressed="no"
DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=158917"
PerMachine="yes"
InstallCommand="/q /norestart"
DetectCondition="VSTORFeature"
InstallCondition="NOT VSTORFeature OR NOT (VSTORVersionV4R >=v10.0.40303) OR NOT (VSTORVersionV4 >=v10.0.21022)" />
This is the log file part. It does this about three times.
[0D98:06A8][2013-07-22T11:47:31]w343: Prompt for source of package: VSTORuntime, payload: VSTORuntime, path: F:\vstor_redist.exe
[0D98:06A8][2013-07-22T11:47:31]i338: Acquiring package: VSTORuntime, payload: VSTORuntime, download from: http://go.microsoft.com/fwlink/?LinkId=158917
[16A0:0BE4][2013-07-22T11:47:37]e000: Error 0x80070490: Failed to find expected public key in certificate chain.
[16A0:0BE4][2013-07-22T11:47:37]e000: Error 0x80070490: Failed to verify expected payload against actual certificate chain.
[16A0:0BE4][2013-07-22T11:47:37]e000: Error 0x80070490: Failed to verify signature of payload: VSTORuntime
i think you need to specify Certificate key in the RemotePayload tag, like this :
<ExePackage Id="VSTORuntime" SourceFile="vstor_redist.exe" Permanent="yes" Vital="yes" Cache="no" Compressed="no"
DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=158917"
PerMachine="yes"
InstallCommand="/q /norestart"
DetectCondition="VSTORFeature"
InstallCondition="NOT VSTORFeature OR NOT (VSTORVersionV4R >=v10.0.40303) OR NOT (VSTORVersionV4 >=v10.0.21022)">
<RemotePayload ProductName="Windows Installer 4.5"
Description="Windows Installer 4.5 Setup"
CertificatePublicKey="F321408E7C51F8544B98E517D76A8334052E26E8"
CertificateThumbprint="D57FAC60F1A8D34877AEB350E83F46F6EFC9E5F1"
Hash="86E1CC622DBF4979717B8F76AD73220CDB70400B"
Size="3327000"
Version="4.5.0.0" />
</ExePackage>
it's just an idea ...
or Try to use fiddler to find if they'r an error 404 or something like this ...
I've encountered this problem when the bootstrapper bundle is compiled with one version of the exe package, but another version is sitting alongside the installer executable when you try to run it. I suspect that Burn automatically pulls the certificate information out of the source file when you compile the bundle.
If for example your Setup.exe file was in C:\Downloads and C:\Downloads also contains a version of vstor_redist.exe which is different to the one present when you built Setup.exe, you'll see this error. You can work around the problem by deleting vstor_redist.exe from C:\Downloads - Setup.exe will then go off and download the correct version from the URL you specified.
It appears that Microsoft had updated the package behind that URL, and changed the certificate that was used to sign it. This is indistinguishable from an attacker serving up a malicious file, so the only thing you can do is build a new bundle from the new file with the updated certificate. In later versions of 3.x, you had to specify SuppressSignatureVerification="no" when not using RemotePayload and you wanted signature verification instead of hash verification.