Search code examples
wpfwixbootstrapper

WIX BootStrapper installer - command line execution


I have a WIX Bootstrapper installer with WPF UI where user can choose which sub-packages they want to install/Uninstall.

Now I have a requirement to run the installer via command line and also user can choose the sub-packages by proving the command line arguments.

At the end it should also give some status if it was successful or not in the cmd itself.

Can you please help me as I am able to able to achieve this..

Thanks in advance


Solution

  • If you don't want to install package by default

    1. In your Bundle add element WixVariable with Name = VarName and Value = NotVarValue attributes.
    2. For package in your Chain add attribute InstallCondition="VarName = "VarValue""
    3. To install this package when calling your bootstrapper in cmd type: Bootstrapper.exe /VarName = "VarValue"

    (If you do want to install package by default, just define WixVariable with value which matches InstallCondition. Then to disable package pass different value)

    For sending result message deal with ApplyComplete event in your custom BA. More exotic ways are described here: How to use CustomAction in WIX Bundle? (the idea is to launch some executable in the end of your Chain which will write to cmd)