[wix-users] Creating temporary Upgrade table record during install, need help please!

Steve Ogilvie sogilvie at msn.com
Mon Nov 30 05:59:41 PST 2015


 have the temporary record working, BUT I am not sure why it is not being kicked off (upgradecode to remove an old MSI that is not in an upgrade package)This block is the custom action code in the Product.wxs, I have not yet implemented the search for the 2 products that still use the MSI (so if either of these two other products are installed I will not remove this MSI on upgrade of my current product that is being upgraded... (so you can ignore the Value= strings...<!-- Remove Core Plug-ins on upgrade -->
<Custom Action="CA_Set_RemovePluginsOnUpgrade" Before="InstallValidate">WIX_UPGRADE_DETECTED</Custom>
<Custom Action="CA_REMOVEPLUGINS_ONUPGRADE" After="CA_Set_RemovePluginsOnUpgrade">WIX_UPGRADE_DETECTED</Custom>
</InstallExecuteSequence>

<CustomAction Id="CA_Set_RemovePluginsOnUpgrade" Property="CA_REMOVEPLUGINS_ONUPGRADE" Value="[ADMIN_GUID]|[CLIENT_GUID]|[CLIENT_MSI_GUID]|[PLUGIN_GUID]" HideTarget="yes"/>
<CustomAction Id="CA_REMOVEPLUGINS_ONUPGRADE" BinaryKey="BIN_CustomAction" DllEntry="RemovePluginsOnUpgrade" Impersonate="yes" Execute="immediate" Return="asyncWait"/>Custom Action:[CustomAction]
public static ActionResult RemovePluginsOnUpgrade(Session session)
{
    try
    {
        if (session == null)
        {
            throw new ArgumentNullException("session");
        }

        var db = session.Database;
        var upgradeView = db.OpenView("SELECT * FROM Upgrade");
        upgradeView.Execute();

        var info = session.Database.Tables["Upgrade"];
        Record record = session.Database.CreateRecord(info.Columns.Count);
        record.FormatString = info.Columns.FormatString;
        record.SetString(1, "{<upgrade code>}");  // UpgradeCode
        record.SetString(2, "15.4.10.19");                              // VersionMin
        record.SetString(3, "15.4.10.19");                              // VersionMax
        record.SetString(4, "");                                        // Language
        record.SetInteger(5, 0x00000300);                               // Attributes
        record.SetString(6, "");                                        // Remove
        record.SetString(7, "REMOVEPLUGINS");                           // ActionProperty

        WriteInfoLogInstall(session, "record is: " + record, true);

        upgradeView.InsertTemporary(record);            //InsertTemporary
        upgradeView.Close();

    }
    catch (Exception ex)
    {
        WriteErrorLogInstall(session, "RemovePluginsOnUpgrade failed: ", ex, true);
        return ActionResult.Failure;
     }

     WriteSuccessLogInstall(session, "RemovePluginsOnUpgrade: The removal of the old Core Plug-ins from the system succeeded.", true);
     return ActionResult.Success;
}How can I log the temporary record from the Upgrade table?I tried using db.Export("Upgrade", "C:\temp\upgradetable.txt"); but that blew an exception...Log file looks good but the product is not uninstalled :(Logfile:Calling custom action TitusInstaller!Titus.Installer.CustomActions.CustomAction.IlluminateRemovePluginsOnUpgrade
INFO:  -----------------------------------------------------
record is: UpgradeCode = {<upgradeCode>}, VersionMin = 15.4.10.19, VersionMax = 15.4.10.19, Language = , Attributes = 768, Remove = , ActionProperty = REMOVEPLUGINS
SUCCESS:  -----------------------------------------------
IlluminateRemovePluginsOnUpgrade: The removal of the old Core Plug-ins from the system succeeded.
Action ended 18:52:53: CA_REMOVEPLUGINS_ONUPGRADE. Return value 0.Any idea why this is not happening? I am at a total loss :(I am trying to create an Upgrade to detect and uninstall a MSI that is not in the new product, but I need to conditionally remove it (it two other products are installed not remove it since they still use that MSI, the upgrade looks like this:<!-- On in place upgrade we want to remove the Core Plug-ins from 4.4 RTM -->
<Upgrade Id="{<upgrade GUID of MSI to rmeove>}">
    <UpgradeVersion Property="REMOVEPLUGINS" IncludeMaximum="yes" IncludeMinimum="yes" Minimum="15.4.10.19"  Maximum="15.4.10.19"/>
</Upgrade>Thanks,Steve 		 	   		  


More information about the wix-users mailing list