Adding the possibility to migrate Features at upgrade

Apr 2, 2015 at 9:32 AM
Hi,
I try to look in the code but didn't found this possibility. When upgrading being able to detect the previous installation and its installed features. i use this to do it :
 private static void Compiler_WixSourceGenerated(XDocument document)
    {
     var docRoot = document.Root;
     var migrate = docRoot.Select("Product/Upgrade/UpgradeVersion");
        migrate.AddAttributes(
              new Dictionary<string, string> 
                    {
                        {"MigrateFeatures","yes"}
                    }
                             ); 
    }
could you add this in the majorUpgrade options or someplace relevant ?
Coordinator
Apr 3, 2015 at 11:58 AM
Sure.

But keep in mind that modifying XML the way you did is not a "dirty trick". It is a legitimate approach handling the situations when you need to access optional WiX attributes not covered by Wix#. And it does not have to be heavy :) Thus your example can be as expressed light as follows:
Compiler.WixSourceGenerated += 
            document => document.Root
                                .Select("Product/Upgrade/UpgradeVersion")
                                .AddAttributes("MigrateFeatures=yes");
Nevertheless I consider MigrateFeatures to be a useful one and will add it to the next release.

Txs for feedback.