[wix-users] Delay installing (application) pre-requisites
Phill Hogland
phill.hogland at rimage.com
Tue Oct 27 14:40:06 PDT 2015
Neil has a couple of good examples on his WixExtendedBA web site, which are somewhat similar to what you are trying to do.
https://wixextba.codeplex.com/SourceControl/latest#Examples/Bundle10.wxs
I am still a learner also, but when I was using WixStdBA I used Neil's code to get me going in this area. Whether using WixStdBA with a BAfunctions.dll, or using a mba, I do not tend to use selectable MSI Features. I have heard others here say that controlling MSI Features can be a 'black whole' so I never tried that approach. Rather I package each application (or selectable group of applications) in a MSI with a Feature that is either installed or not installed, and I may have a sub-feature that is advertised. Then my bundle.exe (OnPlan or PlanPackageBegin) selects the ExePackage or MsiPackage in the chain that should be installed based on input collected from the user or detected prior to DetectComplete.
When using WixStdBA:
Declare an overridable variable like this in the Bundle
<Variable Name='MyVar' Value='1' Type='numeric' Persisted='yes' bal:Overridable='yes'/>
Then in the bundle change the Engine.NumericVariable to zero to NOT install it. For WixStdBA us the BAFunctions.dll project like the sample that is in the wix source zip file, with sample c++ code to set a variable.
And in the ExePackage/@InstallCondition=''MyVar=1". If you decide to use a string variable, which I avoided when just doing logic control, then you need inner quotes around the string: InstallCondition=''MyStringVar='1' "
But when using a mba in PlanPackageBegin I do not declare the Variables and just detect the package I am concerned about using e.PackageId and return RequestState.None (or whatever is appropriate).
-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of George Legge
Sent: Tuesday, October 27, 2015 3:51 PM
To: 'WiX Toolset Users Mailing List' <wix-users at lists.wixtoolset.org>
Subject: Re: [wix-users] Delay installing (application) pre-requisites
Hi Phill,
Thanks for the reply, very helpful as I certainly got the wrong impression from that SO post.
We want to use the WixStdBA for now and will do a full mba in the next phase when we will customise the UI a lot more.
How can we tell in the bundle which Features have been chosen and to install IIS for only feature one with the following wee example of 2 FEATURES, Chain and IIS Installer elements (I took these from an SO post (http://stackoverflow.com/questions/24439602/wix-burn-install-iis-if-not-yet
-installed/24491306#24491306) ?
<Feature Id="Feature1"
Title="IISAPP"
Description="Needs IIS and .Net 4.5 to run"
Level="1">
<ComponentGroupRef Id="Component1" />
<ComponentGroupRef Id="Component2"/>
</Feature>
<Feature Id="Feature2"
Title="ExecNoIIS"
Description="Executable requires only .Net 4.5"
Level="1">
<ComponentGroupRef Id="Component3"/>
</Feature>
<Chain>
<PackageGroupRef Id="InstallIIS"/>
<MsiPackage SourceFile="MyInstaller.msi" />
</Chain>
<Fragment>
<PackageGroup Id="InstallIIS">
<ExePackage
Id="IIS_part0"
SourceFile="run.bat"
DisplayName="Installing IIS:
IIS-WebServerRole"
InstallCommand="dism.exe /Online /Enable-Feature /FeatureName:IIS-WebServerRole" >
</ExePackage>
<ExePackage
Id="IIS_part1"
SourceFile="run.bat"
DisplayName="Installing IIS:
IIS-WebServer"
InstallCommand="dism.exe /Online /Enable-Feature /FeatureName:IIS-WebServer" >
</ExePackage>
etc..............................
Thanks George.
-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Phill Hogland
Sent: 27 October 2015 16:08
To: WiX Toolset Users Mailing List
Subject: Re: [wix-users] Delay installing (application) pre-requisites
I don't think this runs against the Burn ethos at all, and the SO post is more confusing than informative.
The 'mbaprereq' installer for Burn, only comes into play when you have a managed BA application, in which case .Net is needed for the installer to run. But all other prereqs, including a different version of .Net than the version used by the installer, are listed in your bundle chain and completely under your control as to whether they will be installed. The exact approach depends on whether you are using a mba or WixStdBA and other factors.
I originally used WixStdBA (which is all c++) so there is no .Net dependency (or wix provided prereq). I have one app that requires NetFx3 and others require NetFx4, so in a WixStdBA one approach is to use Variables with Overwritale="yes" which you BA then sets, to condition your ExePackage/@InstallCondition using the variables. For WixStdBA you can use a BAfunctions.dll for most Detect and Plan scenarios, (or you could write a
c++ BA). But generally the common approach when more flexibility is
c++ needs
is to create a managed ba. The Setup\WixBA in the wix source is not a
tutorial, but is a functional example that is useful to study. In my case
I let the wix mbaprereq install the NetFx4.5 that my installer needs (and most of my apps also need), but I still have the pesky app that needs NetFx3, which I only install optionally by using PlanPackageBegin handle.
And I take a similar approach for other optional packages (msi or EXE) like SQL Server. And if you look at the str ucture of other wix based installers, like the ones produced by Microsoft they also have optional dependencies which are selectable at runtime in a Burn chain.
-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of George Legge
Sent: Tuesday, October 27, 2015 10:38 AM
To: wix-users at lists.wixtoolset.org
Subject: [wix-users] Delay installing (application) pre-requisites
Hi,
I have been looking around for a solution to this all afternoon and have not come up with much so far except that what I want to do appears to go against the whole ethos of Burn.
I realise Burn was designed as a bootstrapper to get pre-reqs installed and found a similar question on Stackoverflow which was pretty much shotdown in flames (http://stackoverflow.com/questions/31754761/can-i-install-net-using-wix-wit
hout-creating-a-burn-project)
The problem I have is that my application has 2 parts which can be installed together or on their own. One is a web application and the other an executable.
They each need .Net 4.5 however only one of them requires IIS.
So I need the pre-reqs to not be installed until after the user chooses the options in the UI. So if they choose the exec only, then there is no need to install IIS at all. The pre-reqs are for our applications and not a pre-req for the installer.
Can this be done and easily and if so, how ?
Hope this makes sense.
Thanks, George.
____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
More information about the wix-users
mailing list