Upgrade Error

Dec 17, 2015 at 12:39 PM
Hi Oleg,
could you explain me the reason for fail out of upgrade process. Let me delineate my proceeding.
You should know that I have to displace some files from the installdir to a another directory after installFinialize-Step to finish the installation process. After successful deinstallation of the product I remove this directory also normally. On upgrade process this action should be skipped. Unfortunately it fails. I am using an registry entry to verify the current installed version.
Before LaunchConditions step I check the environment, set some session properties and create the directories if required.
1. I included a Majorupgrade element
project.MajorUpgradeStrategy = new MajorUpgradeStrategy
{
UpgradeVersions = VersionRange.ThisAndOlder,//OlderThanThis
PreventDowngradingVersions = VersionRange.NewerThanThis,
RemoveExistingProductAfter = Step.InstallInitialize,//InstallFinalize,
NewerProductInstalledErrorMessage = "Eine neuere Version von [ProductName] existiert bereits",
};
Besides I activated a migration option from majorupgrade using
Compiler.WixSourceGenerated += document => document.Root.Select("Product/Upgrade/UpgradeVersion").AddAttributes("MigrateFeatures=yes");
I am using a unique upgradecode for the product
project.UpgradeCode = new Guid("D510981C-D7A1-4A29-8B45-F58C7950A4FC");
Depend on product version I create a unique project GUID.
Here you see my managed actions:

new ManagedAction("PropertyConfiguration", Return.check, When.Before, Step.LaunchConditions, Condition.Always, Sequence.InstallUISequence),
new ManagedAction("PropertyConfiguration", Return.check, When.Before, Step.LaunchConditions, Condition.Always, Sequence.InstallExecuteSequence),
new ManagedAction("DocuAndDBVersionHandling", Return.check, When.Before, Step.LaunchConditions, Condition.Always, Sequence.InstallExecuteSequence),
/*new ManagedAction("PropertyConfiguration", Return.check, When.Before, Step.LaunchConditions, Condition.NOT_Installed, Sequence.InstallUISequence),
new ManagedAction("PropertyConfiguration", Return.check, When.Before, Step.LaunchConditions, Condition.NOT_Installed, Sequence.InstallExecuteSequence),
new ManagedAction("DocuAndDBVersionHandling", Return.check, When.Before, Step.LaunchConditions, Condition.NOT_Installed, Sequence.InstallExecuteSequence),*/
new ManagedAction("CheckingIsRunning", Return.check, When.After, Step.PreviousAction, Condition.Always, Sequence.InstallExecuteSequence),
//new ManagedAction("CheckingIsRunning", Return.check, When.After, Step.PreviousAction, Condition.NOT_Installed, Sequence.InstallExecuteSequence),
new ManagedAction("OSVersionDetection", Return.check, When.After, Step.InstallInitialize, Condition.Always, Sequence.InstallExecuteSequence),
//new ManagedAction("OSVersionDetection", Return.check, When.After, Step.InstallInitialize, Condition.NOT_Installed, Sequence.InstallExecuteSequence),
//new ManagedAction("FrameworkHandling", Return.check, When.After, Step.PreviousAction, Condition.NOT_Installed, Sequence.InstallExecuteSequence),
//new ManagedAction("DocuAndDBHandling", Return.check, When.After, Step.InstallFinalize, Condition.NOT_Installed, Sequence.InstallExecuteSequence),
new ManagedAction("ShortCutHandling", Return.check, When.After, Step.InstallFinalize, Condition.Installed, Sequence.InstallExecuteSequence),
/*new RegValueProperty("NETFRAMEWORK35", RegistryHive.LocalMachine, @"Software\Microsoft\NET Framework Setup\NDP\v3.5", "ClientInstall", "0"));*/
//new ManagedAction("WriteLog", Return.check, When.After, Step.PreviousAction, Condition.NOT_Installed, Sequence.AdminExecuteSequence),//);
// new Dir(@"[INSTALLDIR]",new File(binaries, @"AppFiles\OldConfigData.exe"),new File(binaries, @"AppFiles\OldConfigData.exe")),
/*new Dir(@"[INSTALLDIR]",
new File(binaries, @"AppFiles\OldConfigData.exe")),*/
//Tools.Instance.DatabaseDirPath //Return.asyncNoWait
new ManagedAction("DirResolution", Return.check, When.After, Step.InstallFinalize, Condition.Always, Sequence.InstallExecuteSequence),
//new ManagedAction("DirResolution", Return.check, When.After, Step.InstallFinalize, Condition.NOT_Installed, Sequence.InstallExecuteSequence),

new ManagedAction("RemoveStep", Return.check, When.After, Step.RemoveExistingProducts, Condition.Installed));
Regards,
Olga
Jan 3, 2016 at 11:41 PM
>...could you explain me the reason for fail out of upgrade process...
Sorry I cannot. This is rather a WiX question not Wix#. What you are doing is very unorthodox and WiX doesn't naturally supports it (despite the fact it can be achieved).

Though I see a few points that can potentially help you:
  • You are relying on UpgradeVersion element (via MajorUpgradeStrategy) instead of MajorUpgrade. There nothing wrong with this except WiX has introduced MajorUpgrade to dramatically simplify upgrading. Have a look at MajorUpgrade samples. Specifically at differences between Project.MajorUpgrade and Project.MajorUpgradeStrategy.
  • "Depend on product version I create a unique project GUID." It's not a good idea as you can easily get some GUIDs out of sync. Consistently same project GUID (without event touching other GUIDs) ensures that your product have unique upgrade code and incrementable product code. Read more here: https://wixsharp.codeplex.com/wikipage?title=Deployment%20scenarios#_naming
  • If it was for me I would rather ditched all these multiple ManagedActions and have only a single one ideally based on ManagedEvent. This way you will have your custom deployment (dir adjustments algorithm) implemented nicely in C# with the trivial deployment implemented purely as WiX/Wix# entities. Currently your custom deployment is too fragmented.