Search code examples
wixburn

Wix burn skip package in chain


Is there a way to skip one of package in chain? I have looked at "InstallCondition" and have code like this.

                      <ExePackage Id="RoboMongo"
                        DisplayName="RoboMongo"
                        Cache="no"
                        Compressed="no"
                        PerMachine="yes"
                        Permanent="no"
                        Vital="no"
                        Name="redist\Robomongo-0.8.4-RC2-i386.exe"
                        DownloadUrl="$(var.RoboMongoUrl)"
                        InstallCondition="ComponentSelect_5"
                        InstallCommand='/Action=Install'
                        UninstallCommand="/Action=Uninstall"
                        RepairCommand ="/Action=Repair"
                        DetectCondition="RoboMongoInstalled">

            <RemotePayload Description="Программа администрирования MongoDB"
            Version ="0.8.4.2"
                ProductName="RoboMongo"
                Hash="71C17E48BC32304FA8724FFA7CA1C4C08891BC97" Size="7141182" />

But i don't want to uninstall it on InstallCondition=false. I just want to skip it.

Thank you in advance.


Solution

  • If you are using managed bootstrapper application, required behavior can be achieved by handling PlanPackageBegin event. Code would look approximately like this:

        public MainViewModel(BootstrapperApplication bootstrapper)
        {
            bootstrapper.PlanPackageBegin += (sender, args) =>
            {
                if (bootstrapper.Engine.StringVariables["ShouldSkipPackage"] == "1")
                    if (args.PackageId == "RoboMongo")
                        args.State = RequestState.None;
            };
        }