2

We have two installation modes: service and app.

Using Wix#, I couldn't find a way to present this simple two-radio buttons dialog to the user:

Choose your installation:
(*) App [default]
( ) Service

And then choose which files (and action) to deploy/perform accordingly.

How do we even bind the user's decision with the actual operation?

Edit:

I discovered how to do that, eventually, but still can't make the GUI selection affect the deployed files (although the bound property do change). Here is the new, more detailed question:

Property seems to change per user's selection, but conditioned files are not being deployed

Tar
  • 8,529
  • 9
  • 56
  • 127
  • Should have read better, the below is assuming WiX. – Stein Åsmul Sep 15 '19 at 15:41
  • [Are these different features inside you MSI perhaps - as illustrated here](https://superuser.com/questions/783963/automatically-select-features-for-silent-msi-install/785825#785825)? (bottom picture). Maybe I misunderstood the whole question? – Stein Åsmul Sep 15 '19 at 16:14
  • @SteinÅsmul - this question is mainly about how to create the UI and then how to use the user's selection to control the installation flow. – Tar Sep 16 '19 at 07:19

2 Answers2

0

Note: I don't use Wix#.

Service Installation

Same Executable?: Just to be sure, is this the same executable that can run as an app and a service? (I actually made an application capable of doing that once, didn't work too well).

Service Installation: The installation as a service is generally done via built-in MSI constructs (I believe you know this already, this is just for reference and completeness):

Custom Actions: Many people use custom actions to install services. This is generally an MSI anti-pattern (unnecessary, prone to errors, etc...). I believe you would need custom actions to install a service only in some cases - like you propose - unless the binary you refer to are two different files. The custom action(s) would need to register and then start the service. You must also set the boot behavior for the service.


Alternatives?

Assuming the binary is a single binary and not two different ones:

Two MSIs: Is it acceptable to compile two MSI files to do the two different tasks? You would have one MSI to install the service version and one to install the the application version? Install one or the other, make sure installation destinations are different (so MSIs reference counting does not interfere - this also allows the MSIs to be installed both at the same time). You could use a setup.exe bundle to install either one?

Full Monty: I suppose you could install two copies of the binary at the same time, and register one as a service. Then you would need to ask the user to start the service or not? And that would be a custom action to set whether the service will launch automatically on boot or be started manually or right away etc...? Or, could you register and run as a service always and allow the application to be run interactively too? Threading?

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • Thank you for the descriptive answer! However the question is specifically about Wix#, and mainly about how to create the UI and using its result to control the installation flow. – Tar Sep 16 '19 at 07:20
  • Yes, but you will face problems with the installation paradigm if you want to run the same binary in both modes. – Stein Åsmul Sep 16 '19 at 07:22
0

Installation modes

You can make it by features. Feature has fixed files list, formatted before MSI build. If you adds Service and Application features you can countrol what's files to add in destination folder.

By default your files are in Complete feature name, so you need to add anothers. Here is feature example:

Feature examples

Please add your ones and set what to deploy with ADDLOCAL parameter. Just set it on radiobutton click:

session["ADDLOCAL"]="Feature1,Feature2,"

Warrning: when you will do update you need to set previous features names.

GUI installation flow

If i need to make some splitted forms flow i just adds 2 sequences of my dialogs in row and use my JumpTo method for ManagedForm:

/// <summary>
/// Переход к форме определенного типа.
/// </summary>
/// <param name="dialogType">Тип формы.</param>
public bool JumpTo(Type dialogType)
{
    int index = Shell.Dialogs.IndexOf(dialogType);
    if (index < 0)
    {
        return false;
    }

    BeginInvoke(new Action(() => Shell.GoTo(index)));
    return true;
}

After, i need to control behavior for first and last one forms for jump to correct dialog.

Sergey Vaulin
  • 722
  • 4
  • 16