CMake and CPack WiX Standard Bootstrapper Application - wix

according to CPack/WIX documentation
I can create *.msi installer
as described here
Feeding a custom wxs file to CPackWIX
But I need more complex scenario, where I have top level Bundle -> bootstrapper_installer.exe
which in turn run child *.msi installers:
https://wixtoolset.org/documentation/manual/v3/bundle/wixstdba/
It means like I need to run CPack twice firstly to generate product_installer.msi
second time to make main installer - bootstrapper_installer.exe with embedded product_installer.msi
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Bundle Name="Source-Connect" Version="$(var.Version)" Manufacturer="$(var.Manufacturer)" UpgradeCode="69157fdc-819e-4e70-9fac-b2a0840a7a11">
<MsiPackage SourceFile="$(var.Product-Installer.TargetPath)" DisplayInternalUI="no" Compressed="yes">
<MsiProperty Name="LAUNCH_AFTER_INSTALL" Value="[LaunchAfterInstall]" />
<MsiProperty Name="FORCE_CLOSE_APPLICATION" Value="[CloseRunningApp]" />
</Chain>
</Bundle>
</Wix>
Is there way to achieve this using Cmake/CPack?

Related

Wix: Creating Bootstrap .exe for .msp causes original version to uninstall

I am trying to create a Wix Bootstrap executable that contains an .msp patch file. I have generated the patch file using pyro.exe and the patch itself works absolutely fine and updates the required files correctly when ran by itself.
However we package all our .msi's in a Wix Bootstrap project with a custom user interface, which I have cloned for the patch files. However when running the executable this way it removes all the files from the install directory.
Has anyone experienced this issue before or am I doing something wrong? Thank you in advance, let me know if you need further code examples.
BootstrapBundle.wxs
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:vi="http://schemas.visualinstaller.de/VisualInstallerWixExtension">
<Bundle Name="MyProgram" Version="1.0.0.1"
Manufacturer="Test"
UpgradeCode="GUID"
SplashScreenSourceFile="Resources\splash.bmp"
IconSourceFile="Resources\icon.ico">
<Update Location="http://test.laika42.com/UpdateInfo.xml"/>
<BootstrapperApplicationRef Id='ManagedBootstrapperApplicationHost'>
<PayloadGroupRef Id='VisualInstallerRuntimeFiles'/>
</BootstrapperApplicationRef>
<Variable Name="INSTALLFOLDER" bal:Overridable='yes'
Value='[ProgramFilesFolder]Test\MyProgram\'/>
<Chain>
<PackageGroupRef Id='NetFx45Web' /> <!-- Fails to build without this? -->
<MspPackage Id='PatchMsp' SourceFile='C:\Patches\Patch.msp' />
</Chain>
</Bundle>
</Wix>
Just had this problem myself. It seems that the UpgradeCode for the bundle must be different to the UpgradeCode for the MSI - the bundle will remove anything older with the same Bundle UpgradeCode, including the original full MSI. I have to say I find the Wix documentation less than illuminating. Bdum-tsh.
The important bits seem to be having different UpgradeCodes for the MSI, the MSI bootstrapper bundle and the patch bootstrapper bundle but keeping each one of the three the same going forward, and the RelatedBundle element.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<?include $(var.SolutionDir)\Installer\ProductDefs.wxi?>
<?include $(var.SolutionDir)\Installer\version.wxi?>
<!-- A DIFFERENT UpgradeCode to the main bundle, but consistent for all patches. I think. -->
<?define PatchBundleUpgradeCode = "AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA"?>
<!-- The UpgradeCode of the Bundle that was used to deploy the MSI originally. -->
<?define MSIBundleUpgradeCode = "BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB"?>
<!-- ... both of which are different to the MSI UpgradeCode. -->
<Bundle Name="$(var.ProductName) $(var.ProductVersion)"
ParentName="$(var.ProductName)"
Version="$(var.ProductVersion)"
Manufacturer="$(var.Manufacturer)"
UpgradeCode="$(var.PatchBundleUpgradeCode)"
IconSourceFile="$(var.SolutionDir)\Installer\MyIcon.ico"
AboutUrl="https://www.somecompany.com/"
HelpUrl="https://www.somecompany.com/support/"
>
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication
LicenseFile="$(var.SolutionDir)\Bootstrapper\license.rtf"
LogoFile="$(var.SolutionDir)\Bootstrapper\Logo.jpg"
ShowVersion="yes"
SuppressOptionsUI="yes"
/>
</BootstrapperApplicationRef>
<OptionalUpdateRegistration Classification="Update" Name="$(var.ProductName) $(var.ProductVersion)"/>
<RelatedBundle Id="$(var.MSIBundleUpgradeCode)" Action="Patch" />
<Chain>
<MspPackage SourceFile="$(var.ProjectDir)\Release\$(var.ProductName) $(var.ProductVersion) Patch.msp" DisplayInternalUI="yes"/>
</Chain>
</Bundle>
</Wix>
Also, if you want to apply more than one minor patch, make sure your PatchMetadata element (in the patch.wxs, not the bundle.wxs) contains the following attribute otherwise the first patch will apply but subsequent ones won't.
MinorUpdateTargetRTM="1"

wix burn bundle not appearing in "add or remove programs"

I have created a bundle installer using burn, and it is working correctly, I can install and unintsall using the exe, but it isn't appearing in the control panel "add or remove programs"
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle Version="14.0" UpgradeCode="7adb5f07-fb5f-4348-8f28-c821bebdc15e">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication
LogoFile="..\Installers\Graphics\banner.png"
LicenseFile="..\Installers\Text\licence.rtf"
ShowVersion="yes"
ThemeFile="ClassicTheme.xml"
LocalizationFile="ClassicTheme.wxl"
/>
</BootstrapperApplicationRef>
<Chain>
<MsiPackage DisplayName="Install My Stuff" Permanent="no" Name="My Stuff" SourceFile=".\Kits\XL\Stuff.msi"></MsiPackage>
<ExePackage DisplayName="Register Components" Permanent="no" Name="my custom stuff" SourceFile=".\Bin\RegAddIns.exe"></ExePackage>
</Chain>
</Bundle>
</Wix>
Your bundle doesn't have a name is my guess. You're missing several possible attributes in your <Bundle> tag. Usually I would include the Name, Version, Manufacturer, IconSourceFile, and UpgradeCode in the bundle definition. These are all used in the add/remove programs entry.

WiX Burn: Reading LaunchTarget from Registry

I'm new with WiX, and I'm trying to have my Bootstrapper launch my installed application when it completes. To accomplish this, I'm using
<Variable Name="LaunchTarget" Value="path_to_exe"/>
However, it is not easy for me to get the path to the executable. The reason for this is because I'm using <Chain> to install some pre-requisites and then an msi that actually installs my exe.
So to do this, the msi is writting the path to a known location in the registry, and then the bootstrapper reads it and uses it.
The problem is that when the bootstrapper reads the registry, the msi hasn't run yet, so it is unable to run the executable at the end.
Here's my WiX, if it helps:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Bundle Name="My Installation" UpgradeCode="a8964402-f3fc-4878-aafd-31ecda6b685e" Version="1.0.0.0">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication LicenseFile="EULA.rtf"
ThemeFile="theme.xml"
SuppressOptionsUI="yes" />
</BootstrapperApplicationRef>
<Chain>
<PackageGroupRef Id="NetFx40Redist"/>
<ExePackage Id="OpenSSL" SourceFile="pre-requesite.exe" />
<MsiPackage Id="myInstall" SourceFile="mySetup.msi" />
</Chain>
<util:RegistrySearch Root="HKLM"
Key="Software\myProgram"
Value="myEXEPath"
Variable="myEXEPath"
Result="value"
Format="raw" />
<Variable Name="LaunchTarget" Value="[myEXEPath]"/>
</Bundle>
</Wix>
So, in short, I'm trying to have the RegistrySearch run AFTER the MsiPackage installs. Can this be done? If not, what alternatives do I have?
As I side note, if I manually fill in the registry value before installation, everything works fine. This means that besides the order things are running in, everything is working fine.
RegistrySearches run during the Detect operation. Custom BAs could run Detect after Apply, but that's not really an option since you're using the WixStandardBootstrapperApplication.
Lucky for you, WiX v3.9 added support for running the LaunchTarget already elevated, with the requirement that the path to the target .exe be in the registry under HKLM. So you would do this:
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication LicenseFile="EULA.rtf"
ThemeFile="theme.xml"
SuppressOptionsUI="yes"
LaunchTargetElevatedId="MyAEEId" />
</BootstrapperApplicationRef>
<ApprovedExeForElevation Id="MyAEEId"
Key="Software\myProgram" Value="myEXEPath" />
Edit:
It looks like you are required to set LaunchTarget as well. Why doesn't your bundle know where it will be? You can just put in gibberish for LaunchTarget (WixStdBA will try the registry location first), but can't you use built-in variables and/or MsiProperty elements to locate the exe?

Merging two msi using wix toolset

How to merge two msi using wixedit, presently they are having 4.0 version of wixtoolset. In the documentation they have mentioned that merging two msi in windows is possible using bundles and chain tags. But whenver I try to do it, it always show some error. Please let me know any example of wix tool set to merge two msi using bundle and chain tags.
I am following Bootstrapper method as provided in pdf of wix 3.6. To bundle two msi using chain element.
<?xml version="1.0" encoding="utf-8"?>
<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" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Bundle Name="Prog" Version="0.0.0.1" Manufacturer="my Corporation" UpgradeCode="f380ae43-5df1-4cfe-9297-526e3e333e99">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication LicenseFile="..\license.rtf" />
</BootstrapperApplicationRef>
<Chain>
<!-- TODO: Define the list of chained packages. -->
<PackageGroupRef Id="Netfx45FullPackage" />
</Chain>
</Bundle>
<Fragment>
<PackageGroup Id="Netfx45FullPackage">
<MsiPackage Id="Prog" Cache="no" Compressed="no" DisplayInternalUI="yes" Vital="yes" SourceFile="$(var.installerPath)\Prog.msi" />
<MsiPackage Id="Prog2" Cache="no" Compressed="no" DisplayInternalUI="yes" Vital="yes" SourceFile="$(var.installerPath)\Prog2.msi" />
</PackageGroup>
</Fragment>
</Wix>
you can add the variable installerPath

How to check and install required .net version while installing bootstrapper application

Following is the code for my bootstrapper application:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Bundle Name="BootstrapperSetup" Version="1.0.0.0" Manufacturer="Company" UpgradeCode="XYZ">
<Chain>
<ExePackage SourceFile="C:\SW\XYZ.exe" Compressed="yes"></ExePackage>
<MsiPackage SourceFile= "C:\SW\ABC.msi" Compressed="yes" DisplayInternalUI="yes"/>
<MsiPackage SourceFile="C:\SW\PQR.msi" Compressed="yes" Name ="INSTALLDIR"/>
</Chain>
</Bundle>
</Wix>
Before installing all the 3 packages, I want to check weather .net framework is installed on the machine or not, and if not, then i need to install it from another folder.
Please help me to do the needful.
Depending on the version of .NET you need you can add something like this to your chain:
<PackageGroupRef Id="NetFx40Redist" />
See here for other alternatives: http://wix.sourceforge.net/manual-wix3/wixnetfxextension.htm.
This article talks abut Managed UX and Adding .net for same http://blogs.msdn.com/b/heaths/archive/2011/10/28/introducing-managed-bootstrapper-applications.aspx