Quantcast
Channel: wixsharp Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1354

New Post: How to implement Rollback?

$
0
0
My solution was something like that. So I could do all with required permissions and refs and even track the status (this topic was helpfull):


Actions:
var runTaskSchedulerAction =
                new ElevatedManagedAction("InstallRunTaskAction",
                    Return.check,
                    When.Before,
                    Step.InstallFinalize,
                    Condition.NOT_Installed)
                {
                    UsesProperties = "Installed, REMOVE, REINSTALL",  // send this values to session to get it like session.CustomActionData["Installed"]
                    RefAssemblies =
                        new[] { Path.Combine(pathToSetupProjectBinDirectory, AssebmlyFileName) }
                };

var stopTaskAndUninstallCertsCustomAction =
                new ElevatedManagedAction("RepairRunTaskAction",
                    Return.check,
                    When.Before,
                    Step.InstallFinalize,
                    Condition.NOT_BeingRemoved)
                {
                    //Condition = new Condition("REINSTALL=ALL"), //somehow it with this option it doesnt appear
                    UsesProperties = "Installed, REMOVE, REINSTALL", ,
                    RefAssemblies = new[] { Path.Combine(PathToSetupProjectBinDirectory, .AssebmlyFileName) }
                };
Custom actions looks something like this:
[CustomAction]
        publicstatic ActionResult InstallRunTaskAction(Session session)
        {
            var installDir = session.Property("INSTALLDIR");    
            ActionResult resultOfOpeartion = MyInstallLogic(installDir);

            if (resultOfOpeartion != ActionResult.Success)
            {
                // NOTE: rollback doesn't call unsintall custom action. Need to remove all manually                // ... my remove logicreturn  ActionResult.Failure;
            }
            return ActionResult.Success;
        }


    [CustomAction]
        publicstatic ActionResult RepairRunTaskAction(Session session)
        {
             var statusService = new InstallationStatusService(session.CustomActionData);
           // service read data from passed propeties added to CustomActionData//  where we do check like    CustomActionData["REINSTALL"] == "ALL"if (!statusService.IsRepairing) // and here it checks the status of installationreturn ActionResult.Success;

            //... other logicreturn ActionResult.Success;
        }
does project.DefaultUsesProperties can send assembly even to default events like BeforeInstall ?

Viewing all articles
Browse latest Browse all 1354

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>