WiX bootstrapper disable .NET Framework installation chaining - wix

In my WiX installer, I do not want .NET installed automatically if it isn't installed. It should just give a warning or merely error out.
The reason to avoid it is explained here:
One HUGE word of
caution here: Because the .Net installer will technically be part of
your install chain, if the user installs .Net but then cancels your
install, your installer will still be listed in the Add/Remove
programs since one if it’s components (the .Net installer) completed.
Tread with caution.
He seems to be intentionally including it. But I'm not and I happened to set <supportedRuntime version="v4.5" /> which I guess isn't a real version (4.5 => 4.0 as far as this is concerned?). My WiX managed bootstrapper application exe automatically prompted me to download and install the "missing" .NET Framework.
For computers that ARE missing 4.0, I don't want this to happen. WiX also complains if I leave out:
<WixVariable Id="WixMbaPrereqLicenseUrl" Value="..." />
<WixVariable Id="WixMbaPrereqPackageId" Value="..." />
in which I literally leave in ... because I don't want it to work anyway.
In this thread, #Shruthi asks
Is there a way to replace the prerequisite .Net install UI with just an notification to the user that they need to install a particular version of .Net before they can install the bundle?
And Rob Mensching replies:
Yes, that is possible now.
... BUT HE DOESN'T ELABORATE. How is it possible now?
Thanks!
===============
In my Bundle's Bootstrap.Config:
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v6" /> <!-- Pretending it's the future! -->
</startup>
The Bundle itself does not reference any .NET stuff and does not reference WixNetFxExtension and uses the custom <BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost" />

To answer how to handle checking for the .Net 4.0 Framework include the WixNetfxExtension in your project
then under product add a reference to the property NETFRAMEWORK40FULL and put a condition on it.
<PropertyRef Id="NETFRAMEWORK40FULL"/>
<Condition Message="This application requires .NET Framework 4.0. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR NETFRAMEWORK40FULL]]>
</Condition>
for the chained case again include wixnetfxextension and include NetFx40Redist package group
<PackageGroupRef Id="NetFx40Redist"/>

Related

Can I move common install conditions to a shared WiX Installer project

I have multiple WiX installer projects in my solution. And all of the installers in the main wxs file under the Product element have the same list of launch conditions, such as privileges, OS version on the target machine, whether NET48 framework is installed or not, etc.
<Condition Message="You need to be an administrator to install this product.">
Privileged
</Condition>
<Condition Message='This product is designed to be installed on Windows 7 or higher Windows Operating System'>
<![CDATA[VersionNT64 >= 601]]>
</Condition>
<PropertyRef Id='WIXNETFX4RELEASEINSTALLED'/>
<Condition Message='This setup requires the .NET Framework 4.8 to be installed.'>
<![CDATA[Installed OR (WIXNETFX4RELEASEINSTALLED >= "#528040")]]>
</Condition>
So I was wondering if it is possible to have these conditions moved into a shared common project in my solution that I can refer to that project from all my installer projects and inject the conditions from that shared place?
If you are only sharing those Launch Conditions then consider using an include file. The conditions will be compiled separately for each project, rather than once, but then you can include them easily without needing to create a shared wixlib.
<?xml version="1.0" encoding="UTF-8"?>
<!-- LaunchConditions.wxi -->
<Include>
<Condition Message="You need to be an administrator to install this product.">
Privileged
</Condition>
<Condition Message='This product is designed to be installed on Windows 7 or higher Windows Operating System'>
<![CDATA[VersionNT64 >= 601]]>
</Condition>
<PropertyRef Id='WIXNETFX4RELEASEINSTALLED'/>
<Condition Message='This setup requires the .NET Framework 4.8 to be installed.'>
<![CDATA[Installed OR (WIXNETFX4RELEASEINSTALLED >= "#528040")]]>
</Condition>
</Include>
then in each project include it with
<?include LaunchConditions.wxi?>
WiX doesn't have a ConditionRef element. It's a shame cause it probably should. However fragements are consumed atomically so if you put them in with something else like a Property you could ref the property and get it all together.
I don't know how clean you want your Condition table but another concept is just put all your conditions in one fragement and share them with all your projects. Then for each condition you an enabling property. This way the condition only evaluates if the property is set.
Here's something I wrote 16 years ago.... I'd be happy to assist if you want to do something like this.
http://blog.iswix.com/2006/07/short-comings-of-launchconditions.html

How to check for .net framework 4.7.1 with Wix 3.11

I am trying to check for .net Version with Wix 3.11 via Condition. This works fine until 4.5 like this:
<PropertyRef Id="NETFRAMEWORK45" />
<Condition Message="This application requires .NET Framework 4.5. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR NETFRAMEWORK45]]>
</Condition>
Checking for anything above 4.5 seems not to be possible - at least not with this mechanism. How can I do that?
That method (PropertyRef) is syntactical sugar. The NetFxExtension preprocessor injects the implementation at compile time. WiX is currently lagging behind. The implementation you are looking for would be something like:
<PropertyRef Id="NETFRAMEWORK45" />
<Condition Message="This application requires .NET Framework 4.7.1. Please install the .NET Framework then run this installer again."><![CDATA[Installed OR NETFRAMEWORK45>=#461308]]>
</Condition>
https://github.com/wixtoolset/issues/issues/5575
Update (hot33331): Added a # before the number 461308. Without that it did not work for me.

Unresolved reference in WiX

I need to check for .NET Framework before installing. I've added this
<PropertyRef Id="NETFRAMEWORK40" />
<Condition Message="This application requires .NET Framework 4.0. Please install the .NET Framework then run this installer again. Contact support at support#Swiftposter.com if you have further issues.">
<![CDATA[Installed OR NETFRAMEWORK40]]>
</Condition>
The start of the file contains
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
and on linking I get the error
error LGHT0094 : Unresolved reference to symbol
'Property:NETFRAMEWORK40' in section 'Product:*'.
Is there a specific place where I should insert these lines? I tried most places I can think of.
You should add reference to WixNetfxExtension.
Use the property NETFRAMEWORK40FULL instead.

Prerequisite bootstrapper application fails to install .NET 4.5

My installer has .NET 4.5 as a prerequisite, when running my installer on Vista (with .NET 4.0 installed) it launches the prerequisite bootstrapper as expected.
Clicking "Install" moves the dialog to a progress page, and that's where it stops.
It just sits at 0% for a while, and then the bootstrapper disappears (exits).
Log snippet:
[0A30:0360][2013-07-11T10:41:23]i300: Apply begin
[093C:06F4][2013-07-11T10:41:23]i360: Creating a system restore point.
[093C:06F4][2013-07-11T10:41:28]i361: Created a system restore point.
[0A30:0360][2013-07-11T10:41:28]i399: Apply complete, result: 0x0, restart: None, ba requested restart: No
[0A30:0360][2013-07-11T10:41:28]i500: Shutting down, exit code: 0x0
[0A30:0360][2013-07-11T10:41:28]i000: The prerequisites were not successfully installed, error: 0x0. The bootstrapper application will be not reloaded.
My .NET package (Which is the first package in the bundle):
<PackageGroup Id="Netfx45Full">
<ExePackage Id="Netfx45Full"
Cache="no"
Compressed="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile="..\Common\PreRequisites\MSIL\dotNetFx45_Full_x86_x64.exe"
InstallCondition="NOT (Netfx4FullVersion="4.5.50709" OR Netfx4x64FullVersion="4.5.50709")"
DetectCondition="(Netfx4FullVersion="4.5.50709") AND (NOT VersionNT64 OR (Netfx4x64FullVersion="4.5.50709"))" />
</PackageGroup>
My bootstrappercore.config has got the following:
<wix.bootstrapper>
<host assemblyName="Bootstrapper">
<supportedFramework version="v4.5" />
</host>
</wix.bootstrapper>
I have been snooping around %temp% and various other locations, and I have been unable to find a .NET install log, so I assume it doesn't get to that point.
Any ideas as to why .NET fails to install or how to troubleshoot it further are greatly appreciated.
Thank you
I had a similar problem. The installer started with .NET 4.0 installed but later crashed, even if I had referenced the .NET 4.5 package in the bundle. My solution was to add the sku attribute to supportedRuntime in BootstrapperCore.config like this:
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
There is a more simple way of installing .NET in Burn in stead of creating your own ExePackage.
http://wix.sourceforge.net/manual-wix3/install_dotnet.htm
Since you want to install .NET 4.5 you should use the WixNetfxExtension PackageGroup : NetFx45Redist
Here is the complete PackageGroup list:
http://wix.sourceforge.net/manual-wix3/wixnetfxextension.htm

Custom WiX Burn bootstrapper user interface?

I'm creating an installation package with WiX 3.6 primarily so I can take advantage of the Burn bootstrapping features. So far I have several MSI packages bundled together that will be installed with the built-in bootstrapper application (WixStandardBootstrapperApplication.RtfLicense).
I have read that Burn allows the default bootstrapper application to be replaced by specifying a custom UX.dll, but I haven't yet been able to locate any resources that describes how the custom ux.dll is constructed (that is, how it integrates with the Burn engine, what technologies do I use, what interfaces should I implement, etc.).
My goal is to create a branded bootstrapper that can collect arbitrary information from a user and pass that information onto the various bundled MSI files, EXE files, etc.
So I have two questions really:
To what degree is the default bootstrapper application customizable?
Are there any resources available that describe how to construct a custom UX.dll?
The key thing to know is that there is a BootstrapperCore.dll in the WiX binaries that defines a BootstrapperApplication class that handles the integration with the Burn engine. I needed to create my own derived class and override the 'Run' method to launch my custom UI.
It was also helpful to use the WixBA project that defines the UI for the WiX bootstrapper as a reference for using the BootstrapperApplication class (src\Setup\WixBA\WixBA.csproj).
The markup I used to reference my custom bootstrapper DLL file is:
<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost" >
<Payload SourceFile="$(var.InstallSourceResources)Bootstrapper\FusionInstallUX.dll"/>
<Payload Id="FusionInstallUX.config"
SourceFile="$(var.InstallSourceResources)Bootstrapper\FusionInstallUX.BootstrapperCore.config"
Name="BootstrapperCore.config" Compressed="yes"/>
</BootstrapperApplicationRef>
The configuration file consists of:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup
name="wix.bootstrapper"
type="Microsoft.Tools.WindowsInstallerXml.Bootstrapper.BootstrapperSectionGroup, BootstrapperCore">
<section
name="host"
type="Microsoft.Tools.WindowsInstallerXml.Bootstrapper.HostSection, BootstrapperCore" />
</sectionGroup>
</configSections>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
</startup>
<wix.bootstrapper>
<host assemblyName="FusionInstallUX">
<supportedFramework version="v4\Full" />
<supportedFramework version="v4\Client" />
</host>
</wix.bootstrapper>
</configuration>
I also followed other examples and appended
[assembly: BootstrapperApplication(typeof([name of class deriving from BootstrapperApplication]))]
to the AssemblyInfo.cs file.
And lastly, Stack Overflow question Specify the INSTALLLOCATION of packages in WiX inside the Burn managed bootstrapper describes how to set and use Burn variables to help drive the installation.
Armed with this information I am now prepared to wreak havoc on the world with my very own custom Bootstrapper application!
To supplement #Bill Campbell's answer, I've written a series of blog posts on writing a custom WiX Bootstrapper in .NET which goes into more depth about the pieces involved, at least for a managed code solution.
Not precisely answer to this question, but if you want to customize appearance of ManagedBootstrapperApplicationHost, then this is what you need to do.
To keep short, you need to declare your variables like this (I put it before BootstrapperApplicationRef)
<WixVariable Id="PreqbaThemeXml" Value="tt.thm" />
<WixVariable Id="PreqbaThemeWxl" Value="tt.wxl" />
assuming tt.thm is your theme file, and tt.wxl is your translation file.
Note those files, as well as all files they reference must be included to BootstrapperApplicationRef as Payoload, like
<Payload SourceFile="tt.wxl"/>
<Payload SourceFile="tt.wxl"/>
<Payload SourceFile="cat.png"/>
As an example of layout you can use mbapreq.thm, found under WiX sources.
In addition to the other resources listed here, a good bare-bones example of a custom bootstrapper application for Burn is Custom WiX Managed Bootstrapper Application.
I found that this is a good place to start with before digging deeper into other more thorough examples like the WixBA project in the WiX sources.
One detail I was missing when setting this up was that I had to include a reference to WixBalExtension.dll. That's because the ManagedBootstrapperApplicationHost is defined in that DLL and used in the bundle like this:
<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
<Payload Name="BootstrapperCore.config"
SourceFile="MyBA.BootstrapperCore.config" />
<Payload SourceFile="MyBA.dll"/>
</BootstrapperApplicationRef>