Burn: Access to msi files inside Bootstrapper.exe - wix

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?

Related

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

is it possible to automatically download Prerequisites using wix bootstrapper

I have created a setup using wix and have even created customized dialogs too.Now i need mySetup to auto download the Prerequisites for my application.Seems it can be done through bootstrapper only.I have even created a bootstrapper file too,but I don't want to attach Prerequisites setup (ie) .exe files in bootstrapper for installing the Prerequisites .Instead i need to download the directly from web and need to install automatically when my setup runs.
is it possible with wix ?? Am new to wix and if its possible please share me some source ??
Thanks in Advance
Simply use SourceFile to avoid any inconvenience.
<ExePackage
Id="InstallJava"
DetectCondition='NOT Installed AND JAVACURRENTVERSION>="1.6"'
InstallCondition='NOT VersionNT64'
SourceFile="..\dep\jre-7u55-windows-i586.exe"
InstallCommand='/s'
Compressed="no"
Permanent="yes"
PerMachine="yes"
Vital="no"
DownloadUrl="http://javadl.sun.com/webapps/download/AutoDL?BundleId=86895"
/>
Download the prereq.exe and use SourceFile attribute to refer it. WiX will automatically calculate the Hashcode, etc.
But if you are more inclined toward using RemotePayLoad then use heat.exe to harvest this data.
<wix-folder>/bin/heat payload d:\prereq.exe -out d:\remote.xml
EXEPACKAGE - you can make use of the DownloadUrl attribute.
DownloadUrl - The URL to use to download the package. The following
substitutions are supported: {0} is replaced by the package Id. {1} is
replaced by the payload Id. {2} is replaced by the payload file name.
RemotePayload - Describes information about a remote file payload
that is not available at the time of building the bundle. The parent
must specify DownloadUrl and must not specify SourceFile when using
this element.
For example:
<PackageGroup
Id="Netfx4Full">
<ExePackage
Id="Netfx4Full"
Cache="no"
Compressed="no"
PerMachine="yes"
Permanent="yes"
Vital="yes"
DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=164193/dotNetFx40_Full_x86_x64.exe" >
<RemotePayload
ProductName="dotNetFx40_Full_x86_x64.exe"
Description="Dotnet 4.0"
Size="3961856"
Version="4.0.5022.0" />
</ExePackage>
</PackageGroup>

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?

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

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

Preventing Msi external file from being compressed and included into burn bootstrapper

Is it possible to include a Msi package into the bootstrapper but not any of it's external files?
So my msi installer has a file:
<Component Directory="INSTALLDIR">
<File Id="DatabaseBackup"
Name="Database.bak"
Source="Database.bak"
Compressed="no" />
</Component>
which outputs:
Installer.msi
Database.bak
Now if I set the burn chain to include the msi package:
<MsiPackage SourceFile="$(var.Installer.TargetPath)" />
the "Database.bak" file is also compressed into the resultant exe. Is it possible to compress the msi but not the .bak file?
If not can someone answer this question better than I can then I won't need to do this at all! :)
I've used the Payload element for this purpose... in your example I would change the MsiPackage element to:
<MsiPackage SourceFile="$(var.Installer.TargetPath)" >
<Payload Compressed="no" SourceFile="{path_to_bak_file}\Database.bak" />
</MsiPackage>
The MSI then picks up the file and uses it as expected.
I haven't found a way to make this conditional or flexible.. in my case it's a config file that is not critical, but my setup now fails (first opens up a file open dialog looking for that file) if the file is missing - of course this depends on the details of the MSI I've created.
Hope this helps