How do I pass a default 'install location' to the RtfLicense bootstrapper? - wix

I'm using an rtflicence standard bootstrapper to install dotnet before my poject msi in a chain.
I noticed that there's an 'options' button which displays an install location dialog and allows the user to change the default installation directory.
I need to either:
Prevent this options button from being displayed, or
Populate the install location with a default path, and pass this back to the installer should the user change it.
I read that it's possible to pass Burn variables to msipackages from bootstrapper but I haven't found any further details and would appreciate being pointed in the right direction.
Thanks

To go with option 1, you'd have to roll your own BootstrapperApplication and remove the options button from the menu.
Option two is significantly easier to implement. The bootstrapper uses a special Burn variable called InstallFolder to get and set what is in the text block on that view, which you can assign inside the Bundle element.
<Variable Name="InstallFolder" Type="string" Value="[ProgramFilesFolder]"/>
The constant ProgramFilesFolder will set the value of that text block when the program starts, and if the user browses to a different directory, it will be stored in that same variable. To pass it to the MSI, in your chain, you pass the InstallFolder using the MsiProperty tag (INSTALLLOCATION is the name of the property in your WiX project).
<MsiPackage Vital="yes" DisplayName="Your Name" Id="MsiId" SourceFile="path/to/file.msi">
<MsiProperty Name="INSTALLLOCATION" Value="[InstallFolder]" />
</MsiPackage>

I just discovered the SuppressOptionsUI option that addresses your Option 1 without rolling your own BootstrapperApplication:
<?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>
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication LicenseFile="..\eula.rtf" SuppressOptionsUI="yes"/>
</BootstrapperApplicationRef>
<Chain>
</Chain>
</Bundle>
</Wix>

I think you can try removing the options button by creating a theme. I haven't had to use themes myself but here are two related SO links that may get you pointed in that direction:
WiX bootstrapper theme file?
Theme for my WiX Installer

Related

WiX standard bootstrapper: launch application after install

I am creating a Bundle installer, using WiX standard bootstrapper in order to install .NET Framework 4.5 (if not yet installed) and my application in the user's computer. The bundle installer also allows the user to set the installation path for the application, and uses WiX standard bootstrapper's UI only (no other installers' interfaces are shown to the user).
Right now I'm struggling to allow the user to launch my application at the end of the installation.
Closest related anwers I could find use a variable named LaunchTarget, which causes WiX standard bootstrapper to display a "Launch" button in the end of the installation.
Given solutions and why I wasn't able to use them follow:
Answer "A" suggests setting the LaunchTarget variable to the exact folder inside "Program Files" folder where the application should be installed. This doesn't work for me, because I want to allow the user to specify the target installation folder (application can be installed outside of the "Program Files" folder).
Answer "B" suggests setting the LaunchTarget variable by using the InstallFolder variable to determine where the user configured the standard bootstrapper to install the software to. This seemed perfect for my case, but after setting the LaunchTarget value simply to "[InstallFolder]" I verified that pressing the "Launch" button in the standard bootstrapper's UI actually opens the folder where the installer is running, and not the folder where the user chose to install the software, as I expected. (is that a bug?)
Question is: how can I correctly set the LaunchTarget variable to the right path, considering that the user can modify the installation folder through WiX standard bootstrapper's UI?
The code for the Bunde follows.
<?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 Name="My Game Trainer" Manufacturer="MY_MANUFACTURER_ID_HERE" UpgradeCode="MY_GUID_HERE" Version="!(bind.packageVersion.TrainerMsiPackage)" DisableModify="yes">
<Variable Name="LaunchTarget" Value="[InstallFolder]" />
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLargeLicense">
<bal:WixStandardBootstrapperApplication ShowVersion="yes" LicenseFile="PATH_TO_MY_LICENSE.rtf" />
</BootstrapperApplicationRef>
<Chain>
<PackageGroupRef Id="NetFx45Web"/>
<MsiPackage Id="TrainerMsiPackage" SourceFile="$(var.SetupMSI.TargetPath)" DisplayInternalUI="no">
<MsiProperty Name="TRAINER_INSTALL_DIR" Value="[InstallFolder]"/>
</MsiPackage>
</Chain>
</Bundle>
</Wix>
Using WiX Toolset v3.11.1 (+Visual Studio 2017 Extension).

Generating an EXE from MSI in Wix

I'm tring to generate EXE file from MSI in Wix installer, I added a new project (Bootstrapper) but I can specifying the path of my MSI file
<Bundle Name="Bootstrapper" Version="1.0.0.0" Manufacturer="" UpgradeCode="e45fdbb6-192c-46f7-b4db-d04af69edada">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<!-- TODO: Define the list of chained packages. -->
<MsiPackage SourceFile="WixSetup.msi" />
</Chain>
</Bundle>
Can you help ?
Thanks in advance
Abdulsalam
Add a reference of your msi's wixproj to your bootstrapper application.
You can now reference the msi file like this
<MsiPackage SourceFile="$(var.WixProjName.TargetPath)" />
This will automatically point to the debug location or release location depending on your build mode.
You can see a list of well-defined vars passed to candle.exe in the output when building. You'll see a bunch of defines like "-dWixProjName.Property=Value" and then you can use those values in your bundle xml like so $(var.WixProjName.Property) which will get replaced by the Value before compiling.
You can see a list of the defined properties when you reference another project here: http://wixtoolset.org/documentation/manual/v3/votive/votive_project_references.html

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?

Burn: Access to msi files inside Bootstrapper.exe

Question: Can we access msi files (and other installers) packed with Burn Bootstrapper at install time?
Let's say if we need to read some property, or apply mst just before starting the installation etc.
Is that possible?
Did you try to add the transform as a payload to your MsiPackage element, and set the TRANSFORMS property using MsiProperty element?
<MsiPackage ...>
<Payload Compressed="yes" SourceFile="c:\mytransform.mst"/>
<MsiProperty Name="TRANSFORMS" Value="mytransform.mst" />
</MsiPackage>
If you really need to get the path to embeded payloads, and if you are using the standard bootstrapper, you are going to need to create a bafunctions.dll and do some C/C++ coding.
To create a bafunctions.dll, first download the wix source code and use the project src\burn\samples\bafunctions as an example. To use the bafunctions.dll you have compiled, add it as a payload to the bootstrapper
<BootstrapperApplicationRef ...>
<Payload Compressed="yes" SourceFile="c:\bafunctions.dll" />
</BootstrapperApplicationRef>
That's enough to make the standard bootstrapper call the bafunctions.dll callbacks. You have callbacks for OnDetect(), OnDetectComplete(), OnPlan(), OnPlanComplete(). You can use these functions to do some non-trivial detections and get/set burn variables.
This post has an example on how to use bafunctions.dll to get the path to an embeded payload at runtime:
How to pass the path to a bundle's payload to an msi?

WiX bootstrapper that only shows the package Dialogs or atleast one that doesn't require the license approval

I have a project that I am creating an installer for. I have the msi created that will do the install but I also need to install some pre-reqs (.NET 4.0 and VSTO client tools or whatever they are called)
From what I can tell I need to use a bootstrapper and while it seems to work I really don't want the default dialogs that make me approve the license. I would like to skip that completely. (If I could hide the bootstrapper that would be fine but just having an "Install" button without the EULA would be ok).
Here is the xml I am currently using.
<?xml version="1.0" encoding="UTF-8"?>
<WixVariable Id="WixStdbaLogo" Value="logo.png" />
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
</BootstrapperApplicationRef>
<Chain>
<!-- TODO: Define the list of chained packages. -->
<PackageGroupRef Id="NetFx40Web"/>
<MsiPackage SourceFile="TestRibbonLocationInstaller.msi" DisplayInternalUI="yes" />
</Chain>
</Bundle>
So from what I can tell I need to basically create a custom bootstrap application for this that I then reference as the bootstrapperapplication. By doing this I will be able to better control the UI (Basically hide it).
Is this thought process correct?