How to conditionally install third party applications in WiX Bundle - wix

I have a WiX installer and I have created a bootstrapper project for the same in order to install my pre requisites. However, I would like pre-requisites to only get installed if they are not already there on the system. Is it possible to add such a condition to my code?
This is the code I have right now, where in it installs my application. But I would like to add the conditions to it.
<Fragment>
<PackageGroup Id="OpenTAP">
<ExePackage
SourceFile="..\..\..\External\Prerequisites\OpenTAP\ITS_OpenTap.9.18.5_Installer.exe"
DetectCondition="ExeDetectedVariable"
InstallCommand="/q /ACTION=Install"
RepairCommand="/q ACTION=Repair /hideconsole"
UninstallCommand="/q ACTION=Uninstall /hideconsole" />
</PackageGroup>
</Fragment>

The ExePackage will only install if the DetectCondition is false. So, as long as you are setting the ExeDetectedVariable correctly then Burn will behave exactly as you desire.

Related

WiX burn bootstrapping run different InstallCommand parameter for silent install

I have a Wix installer which needs to use a bootstrapper. I have included an extract of the Bundle.wxs below. It shows the Chain, which is to first install .Net 4.5.2 and then depending upon whether the installer has been called with -s for silent install calls ExePackage with or without the InstallCommand with a value of /S. The "OtherInstaller" is a NSIS (nulscript installer) installer so requires a case sensitive /S to trigger it's silent install. I understand that UILevel=2 is the condition to check for for a silent install, but for some reason "OtherInstaller" is not getting called with the /S silent argument. Then after that the "MainMsiInstaller" is called.
<Chain>
<PackageGroupRef Id="NetFx452Web"/>
<ExePackage Id="OtherInstallerLoud"
SourceFile="..\..\bootstrapper\OtherInstallerFile"
InstallCondition="NOT UILevel=2"/>
<ExePackage Id="OtherInstallerSilent"
SourceFile="..\..\bootstrapper\\OtherInstallerFile"
InstallCommand="/S "
InstallCondition="UILevel=2"/>
<MsiPackage Id="MainMsiInstaller"
DisplayInternalUI="yes"
SourceFile="..\..\bin\$(var.CandleCfgName)\MainMsiInstaller.msi" />
</Chain>
Any help appreciated.
In the end a solution that worked for me (whether the best solution, or not) was to ensure that the version of burn.exe I was using was 3.11.xxxx and InstallCondition="WixBundleUILevel=2" which is a WIX variable which is available in v3.11 upwards.
So in essence...
<Chain>
<PackageGroupRef Id="NetFx452Web"/>
<ExePackage Id="OtherInstallerLoud"
SourceFile="..\..\bootstrapper\OtherInstallerFile"
InstallCondition="NOT WixBundleUILevel=2"/>
<ExePackage Id="OtherInstallerSilent"
SourceFile="..\..\bootstrapper\OtherInstallerFile"
InstallCommand="/S "
InstallCondition="WixBundleUILevel=2"/>
<MsiPackage Id="MainMsiInstaller"
DisplayInternalUI="no"
SourceFile="..\..\bin\$(var.CandleCfgName)\MainMsiInstaller.msi" />
</Chain>

WIX Bootstrapper uninstall without uninstalling MSI how to?

I'm building a WIX Bundle/Chain bootstrapper. It runs and installs like I specified.
I would like to be able to uninstall the bootstrapper without installing the installed MSI. How to accomplish that?
I'm using WIX 3.11.
Other posting here seem to have the opposite behaviour and demand. They seem to use other versions of wix (<=3.10).
Is there a way to accomplish that behaviour?
Some snippets:
...
</Chain>
TK
In your MsiPackage node, add the Permanent flag and set it to yes. When you uninstall your bootstrapper, the msi(s) set this way will remain installed on the machine.
<MsiPackage Id="MSI2KEEP"
Cache="no"
Compressed="yes"
Name="MSI2KEEP"
ForcePerMachine="yes"
DisplayInternalUI="no"
Vital="yes"
**Permanent="yes"**
SourceFile="$(var.MSI2KEEP.TargetPath)"
DisplayName="MSI 2 KEEP"
Description="MSI 2 KEEP" />

Wix Toolset prerequisites: Check for .Net Framework

I have a wix bundle project that I am editing (ver 3.10). I am trying to use the wixnetfxextensions to install .net framework 4.6 if it is not already installed. I created an exepackage that uses the WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED property. I'm guessing I am not using this correctly. Any help on how to use that? Currently the .net framework will not install not matter what.
<Chain>
<PackageGroupRef Id="redist_vc140" />
<PackageGroupRef Id="NetFx461Full" />
<MsiPackage Id="MSI_Installer" SourceFile="C:\Installer.msi"/>
</Chain>
<Fragment>
<PropertyRef Id="WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED"/>
<!-- Install .NET 4.6.1 -->
<PackageGroup Id="NetFx461Full">
<ExePackage Id="NetFx461"
DisplayName="Microsoft .NET Framework 4.6.1"
Compressed="no"
Cache="yes"
PerMachine="yes"
Permanent="yes"
Protocol="netfx4"
Vital="yes"
SourceFile="..\NDP461-KB3102436-x86-x64-AllOS-ENU.exe"
UninstallCommand="/q /norestart"
RepairCommand="/q /norestart"
DetectCondition="NOT WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED" />
</PackageGroup>
</Fragment>
You're doing a lot of extra work to install .net that you don't actually need to do.
To add .net 461 to your installer just include the netfxextension and add
<Bundle>
<PayloadGroup Id="NetFx461RedistPayload">
<Payload Name="redist\NDP461-KB3102436-x86-x64-AllOS-ENU.exe"
SourceFile="C:\path\to\redists\in\repo\NDP461-KB3102436-x86-x64-AllOS-ENU.exe"/>
<PayloadGroup/>
</Bundle>
so that the full installer is included in your bootstrapper. You can ignore this and then the bootstrapper will download the installer but if the customer doesn't have an internet connection they won't be able to install .net.
Then in your chain just add
<PackageGroupRef Id="NetFx461Redist"/>
I used this as a reference and checked the wix source to see what the
name of .net 461 being used is in netfxextension.
Sean Hall mentioned that bundles don't even use properties so what I had written here doesn't apply at all in this situation. (And it was also incorrect)
Did what Brian Sutherland suggested: Added the WxsVariable that compares the .netframework with the determined minimum release number. then make that a detectcondition in the exepackage

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 upgrade needs to uninstall both MSI's before upgrading

I have two MSI's; framework.msi and product.msi. The framework.msi installs dll's into the GAC that the product.msi depends on for both install and uninstall.
I've created a BA that chains the two MSI's together.
<Bundle ...>
<Chain>
<PackageGroupRef Id='framework'/>
<PackageGroupRef Id='product'/>
</Chain>
</Bundle>
<Fragment>
<PackageGroup Id="framework">
<MsiPackage Name="Product Framework"
ForcePerMachine="yes"
SourceFile="framework.msi"
Vital="yes"
Cache="no"
Permanent="no"
Compressed="yes"
Visible="yes"/>
</PackageGroup>
<PackageGroup Id="product">
<MsiPackage Name="Product"
ForcePerMachine="yes"
SourceFile="product.msi"
Vital="yes"
Cache="no"
Permanent="no"
Compressed="yes"
Visible="yes"/>
</PackageGroup>
</Fragment>
For fresh installs, my framework.msi and product.msi install correctly. When I go to upgrade to a new version, it upgrades the framework.msi successfully. Then it proceeds to uninstall the product.msi but it fails (for this error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'CheckInstaller, Version=1.0.0.0' or one of its dependencies. The system cannot find the file specified.) because the uninstall CustomAction references a version of an assembly (CheckInstaller) that is no longer in the GAC (because it has been upgraded as part of the framework.msi upgrade).
Without having to write a custom BA, I want to be able to do something like this:
// pseudo code
if(product.Exists() && framework.Exists())
{
product.Uninstall(); // product is dependent on the framework
framework.Uninstall();
}
framework.Install();
product.Install();
I realize this would be possible if we were to combine the two MSI's into one big product but since we disperse the framework.msi to other teams and for various other reasons, they need to be kept separate.
Is what I want to do even possible to do with the WiX bootstrapper?
That isn't possible with Burn today. The chain is fixed. On install it runs through forward, on uninstall it runs through backwards. I can think of two options available today:
Do not have the MSI's upgrade each other and let the old MSIs be removed when the new Bundle uninstalls the old Bundle.
Avoid creating install time dependencies between packages. This generally is a good thing to do anyway.
A feature request might be to have the new Bundle have the ability to remove the old Bundle before installing instead of after like it is today, but that isn't supported at this point in time.