How to add HTTP header to downloadurl in wix toolset? - wix

Is there any option to add http headers to downloadurl of MsiPackage element?
<MsiPackage
SourceFile="path/to/file.msi"
DownloadUrl="url/to/file.msi"
Compressed="no"
>
</MsiPackage>

No, Burn doesn't support adding headers to payload download requests.

Related

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 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.

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?

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