Howto download a dependency with WIX 3.6 - wix

I'm using WIX 3.6 Bundle to install an application. It requires some prerequisites. How can I set up the package, so that the bootstrapper automatically download the file from the internet?
I know that WIX setup itself does exactly that. But I can't find the difference. Here's my fragment for the .NET Framework 3.5:
<Fragment>
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v3.5" Value="Version" Variable="NetFX35Version" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v3.5" Value="Version" Variable="NetFX35x64Version" Win64="yes" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v3.5" Value="SP" Variable="NetFX35SP" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v3.5" Value="SP" Variable="NetFX35x64SP" Win64="yes" />
<PackageGroup Id="NetFX35">
<ExePackage Id="NetFX35" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="yes"
SourceFile="$(var.TargetDir)dotnetfx35setup.exe"
DownloadUrl="http://download.microsoft.com/download/0/6/1/061F001C-8752-4600-A198-53214C69B51F/dotnetfx35setup.exe"
DetectCondition="(NetFX35Version AND NetFX35SP >= 1) AND (NOT VersionNT64 OR (NetFX35x64Version AND NetFX35x64SP >= 1))" />
</PackageGroup>
</Fragment>
When I use this fragment and the dotnetfx35setup.exe is not present, the Bootstrapper shows a message box, asking if it should download the file. But it should do that automatically.
UPDATE:
I'm using WixStandardBootstrapperApplication. Does the managed bootstrapper application behave different?

WixStdBA always prompts before downloading. I'd suggest filing a feature request to make it something you can suppress. There isn't currently a managed bootstrapper application; ManagedBootstrapperApplicationHost is the infrastructure to support your own managed-code BA.

Related

Wix: getting WixUI_minimal to show when bootstrapper is used

I'm somewhat new to Wix. I created a bootstrapper to check and install .NET version 4 framework if it doesn't exist. In my msi package, I'm using WixUI_minimal installer interface. When I run the bootstrapper.exe, the standard bootstrapper UI shows instead of the WixUI_minimal. Is there a way to have WixUI_minimal present and have .NET framework install in the background without showing the bootstrapper UI? What options do I have here? Any tips would be appreciated. Thanks.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Bundle Name="BootstrapperRedist" Version="1.0.0.0" Manufacturer="Testment Technologies" UpgradeCode="3f40cdd1-640d-4fe6-8edb-17a308d8f227">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<PackageGroupRef Id="NetFx40ClientRedist"/>
<MsiPackage Id="MyApplication" SourceFile="$(var.MicroSynSetupProject.TargetPath)"/>
</Chain>
</Bundle>
<Fragment>
<!-- Check for .NET 4.0 -->
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version"
Variable="Netfx4FullVersion" />
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version"
Variable="Netfx4x64FullVersion"
Win64="yes" />
<PackageGroup Id="Netfx4Full">
<ExePackage Id="Netfx4Full"
DisplayName="Microsoft .NET Framework 4.0"
DownloadUrl="http://download.microsoft.com/download/5/6/2/562A10F9-C9F4-4313-A044-9C94E0A8FAC8/dotNetFx40_Client_x86_x64.exe"
Compressed="no"
Cache="yes"
PerMachine="yes"
Permanent="yes"
Protocol="netfx4"
Vital="yes"
SourceFile=".\dotNetFx40_Full_x86_x64.exe"
InstallCommand="/passive /norestart"
DetectCondition="Netfx4FullVersion AND (NOT VersionNT64 OR Netfx4x64FullVersion)" />
</PackageGroup>
</Fragment>
</Wix>
I decided to change the bootstrapper application UI to include my license, a logo and a theme. This was done by including the WixBalExtension as a reference. This seems like the simplest way to go for the moment in having one unified install UI. The new bootstrapper listing is below.
<?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">
<!--Version="1.0.0.0"-->
<Bundle Name="BootstrapperRedist"
Version="!(bind.packageVersion.MicroSyn)"
UpgradeCode="3f40cdd1-640d-4fe6-8edb-17a308d8f227"
IconSourceFile=".\MS.ico">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication
LicenseFile=".\license.rtf"
ThemeFile=".\RtfTheme.xml"
LogoFile=".\MS_64x64.bmp"/>
</BootstrapperApplicationRef>
<Chain>
<PackageGroupRef Id="NetFx40ClientRedist"/>
<MsiPackage Id="MicroSyn"
SourceFile="$(var.MicroSynSetupProject.TargetPath)"
DisplayInternalUI="no"/>
</Chain>
</Bundle>
<Fragment>
<!-- Check for .NET 4.0 -->
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version"
Variable="Netfx4FullVersion" />
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version"
Variable="Netfx4x64FullVersion"
Win64="yes" />
<PackageGroup Id="Netfx4Full">
<ExePackage Id="Netfx4Full"
DisplayName="Microsoft .NET Framework 4.0"
DownloadUrl="http://download.microsoft.com/download/5/6/2/562A10F9-C9F4-4313-A044-9C94E0A8FAC8/dotNetFx40_Client_x86_x64.exe"
Compressed="no"
Cache="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile=".\dotNetFx40_Full_x86_x64.exe"
InstallCommand="/passive /norestart"
DetectCondition="Netfx4FullVersion AND (NOT VersionNT64 OR Netfx4x64FullVersion)"/>
</PackageGroup>
</Fragment>
</Wix>
On your MSI package you would need to set the attribute DisplaysInternalUI to Yes.
From the documentation:
Specifies whether the bundle will show the UI authored into the msi
package. The default is "no" which means all information is routed to
the bootstrapper application to provide a unified installation
experience. If "yes" is specified the UI authored into the msi package
will be displayed on top of any bootstrapper application UI.
http://wixtoolset.org/documentation/manual/v3/xsd/wix/msipackage.html

how to manually purge an malformed wix-burn package?

I am in the process of learning how to develop a custom managed bootstrapper for wix-burn. Up to my knowlege there are no official tutorials, unofficial tutorials are always filled with WPF stuff which I'm not interested in and most people on forums do not do much more than saying that you must create a class that inherits from BootstrapperApplication and overrides the Run() method.
I did that, created the config file, added the payloads to the xml markup. The resulting installer did nothing, actually it ran forever, only killing it stopped it. I sincerely expected that calling base.Run() would give me some basic default GUI-less behavior. But that is only an abstract method. Eventually I learned that I must call some Engine.functions() to actually do some work. So I wrote this to test:
protected override void Run()
{
Engine.Detect();
Engine.Plan(LaunchAction.Install);
Engine.Apply(IntPtr.Zero);
Engine.Quit(0);
}
I successfully compiled a package that actually installed, the problem is that it can not be uninstalled. My question is, what can I do to purge it from my system? What registry keys must I erase, what cached packages must I delete, and what else must I do to get rid of it?
First, the registry key will be in one of the two locations listed below -- and it's probably the first one since the second is for 32-bit applications installed on a 64-bit OS.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninst‌​all
Second, you can use the registry key to determine where the executable is cached for uninstall, which is probably in a folder that looks like C:\ProgramData\Package Cache.
If this were an .msi installation, there's another registry key and the file is cached in a different location as mentioned here.
Other links:
https://superuser.com/questions/401511/how-to-remove-a-broken-program-from-the-programs-and-features-list-in-windows-7
https://support.microsoft.com/en-us/kb/247501
Ufff, you've got yourself into a hell. :) I'll help you as much as I can.
How did you installed that package?
dlls that you can find interesting:
BootstrapperCore.dll (included with the WiX SDK)
Microsoft.Deployment.WindowsInstaller.dll (included with the WiX SDK)
WindowsBase.dll (for threading)
And, one of XML files should be like this, so you can see what exactly is up there.
<?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">
<Bundle Name="My Test Application" Version="1.0.0.0" Manufacturer="Bryan" UpgradeCode="PUT-GUID-HERE">
<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
<Payload SourceFile="..\TestBA\BootstrapperCore.config"/>
<Payload SourceFile="..\TestBA\bin\Release\TestBA.dll"/>
<Payload SourceFile="..\TestBA\bin\Release\GalaSoft.MvvmLight.WPF4.dll"/>
<Payload SourceFile="C:\Program Files\WiX Toolset v3.6\SDK\Microsoft.Deployment.WindowsInstaller.dll"/>
</BootstrapperApplicationRef>
<Chain>
<PackageGroupRef Id='Netfx4Full' />
<MsiPackage SourceFile="..\DummyInstaller\bin\Release\DummyInstaller.msi" Id="DummyInstallationPackageId" Cache="yes" Visible="no"/>
</Chain>
</Bundle>
<Fragment>
<!-- Managed bootstrapper requires .NET as a dependency, since it was written in .NET.
WiX provides a Bootstrapper for the bootstrapper. The fragment below includes .NET.
For more information or examples see Heath Stewart's blog or the WiX source:
http://blogs.msdn.com/b/heaths/archive/2011/10/28/introducing-managed-bootstrapper-applications.aspx
-->
<WixVariable Id="WixMbaPrereqPackageId" Value="Netfx4Full" />
<WixVariable Id="WixMbaPrereqLicenseUrl" Value="NetfxLicense.rtf" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Version" Variable="Netfx4FullVersion" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Version" Variable="Netfx4x64FullVersion" Win64="yes" />
<PackageGroup Id="Netfx4Full">
<ExePackage Id="Netfx4Full" Cache="no" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes"
SourceFile="C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\DotNetFX40\dotNetFx40_Full_x86_x64.exe"
DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=164193"
DetectCondition="Netfx4FullVersion AND (NOT VersionNT64 OR Netfx4x64FullVersion)" />
</PackageGroup>
</Fragment>
</Wix>
Note: your registry search and conditions are a little different from
what is used in the WiX toolset to detect NETFX. The following is the
detection for NETFX the WiX toolset uses:
<util:RegistrySearch
Id="NETFRAMEWORK40"
Variable="NETFRAMEWORK40"
Root="HKLM"
Key="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full"
Value="Install"
Result="value" />
Next solution can be this:
Include a PackageGroupRef element in your Chain:
<Bundle>
<Chain>
<PackageGroupRef Id="NetFx452" />
<MsiPackage ... />
</Chain>
</Bundle>
Download the Microsoft .NET Framework 4.5.2 (Offline Installer), and add it to your Bootstrapper Project. (I put it in a folder called "Resource".)
Add the following Fragment:
<Fragment>
<util:RegistrySearchRef Id="NETFRAMEWORK45"/>
<PackageGroup Id="NetFx452">
<ExePackage Id="NetFx452"
Cache="no"
Compressed="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
Name="NDP452-KB2901907-x86-x64-AllOS-ENU.exe"
SourceFile="Resource\NDP452-KB2901907-x86-x64-AllOS-ENU.exe"
DetectCondition="NETFRAMEWORK45"
InstallCommand="/q /norestart" />
</PackageGroup>
</Fragment>

Force install fail with message using WiX Bundle MBA

I'm taking over this project and don't have access to the person who set it up initially. Currently the bundle has .net4 included. The desire is to remove the file and make the end user download .net manually. I'm trying to set the bundle up to check the installed .net version (if any), display a details message with a download link if it doesn't meet the reqs then abort the install and close.
Every time I try to remove the variables that point to the .net package I get build errors. This is what I have so far.
<Chain>
<PackageGroupRef Id='Netfx4Full' />
<MsiPackage SourceFile="$(var.TargetDir)Client.msi" Id="Client" Cache="no" Visible="no" ForcePerMachine="yes">
<MsiProperty Name="INSTALLDIR" Value="[InstallFolder]"/>
</MsiPackage>
</Chain>
</Bundle>
<Fragment>
<PropertyRef Id="NETFRAMEWORK40FULL"/>
<Variable Name="InstallationPath" bal:Overridable="yes" />
<WixVariable Id="WixMbaPrereqPackageId" Value="Netfx4Full" />
<WixVariable Id="WixMbaPrereqLicenseUrl" Value="NetfxLicense.rtf" />
<Variable Name="DisplayVersion" Value="$(var.BundleVersion)" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Version" Variable="Netfx4FullVersion" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Version" Variable="Netfx4x64FullVersion" Win64="yes" />
<Condition Message="This application requires .NET Framework 4.0. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR NETFRAMEWORK40]]>
</Condition>
<PackageGroup Id="Netfx4Full">
<ExePackage Id="Netfx4Full" Cache="no" PerMachine="yes" Permanent="yes" Vital="yes" Compressed="no"
SourceFile="DotNetInstallers/dotnetfx40_full_x86_x64.exe"
DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=164193"
DetectCondition="Netfx4FullVersion OR Netfx4x64FullVersion">
</ExePackage>
</PackageGroup>
</Fragment>
Any help would be appreciated.
Based on these lines, it looks like you're using the ManagedBootstrapperApplicationHost.
<WixVariable Id="WixMbaPrereqPackageId" Value="Netfx4Full" />
<WixVariable Id="WixMbaPrereqLicenseUrl" Value="NetfxLicense.rtf" />
The ManagedBootstrapperApplicationHost is the builtin way in WiX to use a custom BootstrapperApplication built in .NET (a managed BA, or MBA). The MBAHost requires you to package .NET in your bundle. If you're concerned about the size of your bundle, then you can use the NetFx4Web package in the WixNetFxExtension. This will make the bundle download the web installer at runtime. You can customize the user interface that appears while installing .NET using mbapreq.thm and mbapreq.wxl.

WiX detect .Net 4.0.3

I have an application that requires .Net 4.0.3 (link).
I've found this article which tells me where I would find the version of .Net which is installed but all I can find is the list of included properties that the WiX compiler recognises (here).
I've tried following the directions in this article, which tells me to use the following code, but this just installs .Net 4 without the update:
<PropertyRef Id="NETFRAMEWORK40FULL"/>
<Condition Message="This application requires .NET Framework 4.0.3. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR NETFRAMEWORK40FULL]]>
</Condition>
How would I go about making WiX check for the specific 4.0.3 update, either through a pre-defined WiX property or checking the registry value myself?
After some reading, I ended up adding a bundle project to my solution that references my main Product in the standard WiX installer project (MyProject.Installer). I then used a RegistrySearch to find the version of the full .Net 4 installation.
<Bundle ....>
<Chain>
<PackageGroupRef Id="Netfx4Full" />
<PackageGroupRef Id="Netfx403Update" />
<MsiPackage Id="MyMsi" SourceFile="$(var.MyProject.Installer.TargetPath)" Compressed="yes" DisplayInternalUI="yes" />
</Chain>
</Bundle>
<Fragment>
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version"
Variable="Netfx4FullVersion" />
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version"
Variable="Netfx4x64FullVersion"
Win64="yes" />
<PackageGroup Id="Netfx4Full">
<ExePackage Id="Netfx4Full"
Cache="no"
Compressed="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile="$(var.ProjectDir)dotNetFx40_Full_x86_x64.exe"
DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=164193"
DetectCondition="Netfx4FullVersion AND (NOT VersionNT64 OR Netfx4x64FullVersion)" />
</PackageGroup>
<PackageGroup Id="Netfx403Update">
<ExePackage Id="Netfx403Update"
Cache="no"
Compressed="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile="$(var.ProjectDir)NDP40-KB2600211-x86-x64.exe"
DetectCondition="Netfx4FullVersion AND (Netfx4FullVersion << "4.0.3" OR Netfx4FullVersion << "4.5")" />
</PackageGroup>
</Fragment>
The condition expands out to Netfx4FullVersion AND (Netfx4FullVersion << "4.0.3" OR Netfx4FullVersion << "4.5") without XML escaping.
The following articles were helpful:
Bundle skeleton code
Bundle package manifest
Defining searches using WiX variables
Chaining packages into a bundle
How to check for .Net versions
Version value within the registry key "SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" will be always 4.0.30319 for .net 4.0 (even if updates have been installed).
Here is the code I have used in my bundle to search if the .net 4.0.3 version was already installed:
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0.3"
Result="exists"
Variable="Netfx403" />
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0.3"
Result="exists"
Variable="Netfx403x64"
Win64="yes" />
Then in your ExePackage DetectCondition:
DetectCondition="Netfx403 AND (NOT VersionNT64 OR Netfx403x64)"

Install .NET Framework 4.0.2 with WiX

I am using WiX v3.7
There I have created my own Bootstrapper. Now, I am able to install .NET Framework 4 when it is not installed.
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Version" Variable="Netfx4FullVersion" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Version" Variable="Netfx4x64FullVersion" Win64="yes" />
<PackageGroup Id="Netfx4Full">
<ExePackage Id="Netfx4Full" Cache="no" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes"
SourceFile="..\..\Lib\DotNetFX40\dotNetFx40_Full_x86_x64.exe"
DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=164193"
DetectCondition="Netfx4FullVersion AND (NOT VersionNT64 OR Netfx4x64FullVersion)" />
</PackageGroup>
Now, my application needs .NET Framework 4.0.2. How can I test and install this if it is not available with WiX?
On which way can I test this? - and what does I have to do to install it?
Thanks for your help.
The 4.0.2 update looks to be just another executable. Chain it after your Netfx4Full. You will need to provide all the detection and URL logic for the new 4.0.2 executable