How do you build conditional logic and user options in WiX? - wix

Having been happy with ClickOnce for a long time, I've been thrust into the weird and wacky world of windows installers. It appears to be a world very short on documentation, unless I don't know what I'm searching for.
I'm aware there's lots of options for building an installer, including Visual Studio setup projects and WiX. Given that I'm looking at a fairly complex scenario, I suspect I'll be going with the latter. What I'm struggling with is doing something like this:
Two things to note about this.
First, it already knows what versions of SQL Server I've got installed. Second, the user can select which options to install and which to skip.
I don't know if there's a particular label for these functions that will help me search for them. But I can't find any details on how to start building this sort of logic into an installer, preferably with WiX.
Can anyone get me started?

This installer UI is WixUI_FeatureTree and it selected by UI reference.
Each line in the UI is a feature.
Each feature can be nested under other feature.
The name of the feature is a property that is set by searching the registry.
To choose if the feature should be enable, expanded etc. check the Feature Element.
Hope it will get you started...

Related

Wix - Select MSI features with Burn bootstrapper [duplicate]

I need to install multiple MSIs from a single unified UI.
I also need a 'feature' tree to let the user select which product(s) to install.
Having looked at similar questions, it seems Burn is the way to go.
Looking at this, it seems I must write a custom BA and implement my own feature tree.
Is this correct?
It seems I'll end-up with a custom UI that won't look like the standard UI for MSIs. This seems a pity when IMHO one the great thing about MSIs is that they always present the same UI to users and have been doing so for years.
If that's the way to go, is there a simple example to get started?
Does wix3.6 really not natively support feature tree? ...seems like a pretty basic and useful feature to have IMHO ...
The feature tree is a custom control on MSI and not available for general use. A standard tree control could be used but no one has added that feature to wixstdba. Of course, you could add the feature (start discussion on wix-devs#lists.sourceforge.net) or implement your own BA. The wixstdba code is in src\ext\BalExtension\wixstdba or for managed example there is src\Setup\WixBA. Both are reasonable places to start.

Simple example of using FeaturesDlg in WIX

The only documentation for the FeaturesDlg I can find on the WIX site is a brief two-line description. I'm finding lots of esoteric, advanced samples of how to attempt to do difficult things, customizations, etc. I just want to know how to use it in the most simple, basic, easy way. I have four features, and I want the user to be able to choose which of them to install. That's all. Can anyone point me to a simple example? Do I need to have a Publish element and manually control the entire sequence of dialogs in order to use the FeaturesDlg?
Use the WixUI_FeatureTree dialog set. See Using Built-in WixUI Dialog Sets.
Wow, all it took was to change the UIRef to this:
<UIRef Id="WixUI_FeatureTree"/>

Wix3 Optionally selecting features

In Wix, how can I construct a feature tree such that when the parent feature is selected via "Will be installed on local drive" some of the child features get selected by default?
I see that only when I select "Entire feature will be installed.." option I see that the sub features are also getting selected, but all of them get selected. I want some granular control over that.
Any pointers?
thanks
What you are seeing is related to Windows Installer Advertisement. Be sure to read:
Advertisement (Windows)
With this form of advertisement you can install an advertised shortcut or COM registration and the feature and it's components and files won't be installed until you actually try to invoke said entry point. This was a design requirement from 10 years ago when hard drives were expensive and to me is a somewhat useless feature.
Personally I would Feature#AllowAdvertise="no" and Feature#TypicalDefault="install" on each of your features. This should get your Custom Setup looking the way you want it. If it doesn't, I might have misunderstood the question and we need to discuss the INSTALLLEVEL concept.
WiX V3 Feature Element

Setup project with managed custom actions. Big heck of a headache

I'm trying to create a setup project and I can't believe how painful it could be. Non of the tools that I've tried to use, haven't satisfy me.
How come? Well, let's see:
First and easiest option: Setup project built in Visual Studio. Easy and fast. you can easily implement custom actions, even if you're code was written in c# or vb.net. Exactly what I wanted. But this approach has some drawbacks and the major one is unbelievably painful way to implement custom dialogs. For example if I need to ask for DB credentials, authorize the user and proceed with the rest of installation. But no. There is no way to build custom setup dialog in VS. Actually there is a way, but it's not an easy one. I mean what, are you kidding me? I have to spent a day to create a couple of simple dialogs?
Second option: Use some kind of a tool. Like InstallShield. You have to pay for it, yes, fortunately it's damn cheap. Only $5500. Not a big deal, right? Well maybe, but for me it's like "dude, forget about it"
Third option: Use WIX Nice, has many options. Not so easy to use like the one built-in VS but has many much better features. The only problem - I spend a few hours trying to convince that thing to run my code written in c#. I failed. Nothing helped and I give up.
Now. Please, please my fellow experts, all knowing developers. Help me. What should I do? What's the best way to solve my problem (believe me my boss will kill me, he likes to achieve results over dead bodies of his employees).
Tell me is there any better way to edit .wid files. Using Orca tool, isn't an easy solution.
Or show me a real example of setup project built with WIX which can run managed c# code.
Thank you!
I implemented a custom dialog by simply displaying a form in my custom action. This is a straightforward thing to do.
I don't suggest using either "Setup Projects" ( aka Visual Studio Deployment Projects ) or Managed Custom Actions ( in your context you are referring to InstalUtil custom actions ).
For managed custom actions I use Windows Installer XML - DTF ( Deployment Tools Framework ). This builds and packages your CA to look and feel to MSI like a C++ CA which means you can then consume it using InstallShield, WiX, Wise and so on.
I also don't suggest using CA's as fake dialogs. If you want a fancier UI write an external UI handler ( not a simple task ). I suspect your real problem though is that VDRPOJ doesn't expose this very well, that WiX is lot's of writing in XML. InstallShield gives you a drag drop IDE for working on custom dialogs. But then that would be one of the many reasons it isn't free.

How to create/Where to get Wix Bootstrapper for Multiple Instances

I'm currently learning how to create msi installers using WiX and it seems I've hit a wall.
All is well when I create an MSI containing everything needed for a single environment.
I have features, and components, and can install my MSI.
Now I'm at the stage where I want to convert this in a SQL Server-style installer, where you have multiple instances support.
At the start I want to user to get a screen which allows him to create a new instance, or manage already existing instances. (to update/remove them)
I've spend 2 full days looking everywhere for a solution, without much luck.
I've found the following resources with some info on it, but either they're limited in the number of instances, or don't describe how to such a bootstrapper which gives a user the option described above.
Multiple Instance MSI's and InstallShield 12
Multiple Instance Transforms Walkthrough
Multiple instance installations and patching
Has anyone achieved this already using WiX? Or can anyone point me towards some working examples on how this is achieved?
I know Installshield 2009 can do this, but since this is just a hobby, I don't have the money to buy that. Also I'd like to do it in WiX, since the upcoming Visual Studio 2010 will improve support for it.
Creating multiple instances is pretty easy with WiX v3. You just use the InstanceTransform and Instance elements to create everything. Now, the bootstrapper problem requires something outside of the WiX toolset since we don't have burn, yet. I'm not sure we'll get this functionality in WiX v3.5 (with burn) but it is on our list for burn post v3.5.
Although I've never created a multi-instance setup, I also noticed that Acresso announced MI support in IS 2009. We have IS 2009 but didnt use this feature.
However, Installshield often simply makes use of new MSI features by offering an "intuitive" frontend to them (like for chaining multiple MSIs together into one). So you might want to look for general information on how to achieve that by using the MSI SDK.
Here are some useful links that might point you to the right direction:
Authoring Multiple Instances with Instance Transforms
Multiple Instance Transforms Walkthrough, Proposed Simple Addition to WiX to Make Them Easier