moussaoui
Posts: 4
Joined: Mon Mar 18, 2024 10:30 am

Failed to set OLDPRODUCT property value

Hello,

I am using AdvancedInstaller Enterprise edition version 22.2.

In my project we using "uninstall old version first, then install new version" order for an upgrade,During a rollback, we used a PowerShell script to restore the product to a previous version, and it worked as expected.

The main problem occurs when a user attempts to reinstall the product after a rollback occured; the installer fails to detect the old installed version that has been restored, resulting in the OLDPRODUCT property value being empty.

Code: Select all

AI_SetMsiProperty OLDPRODUCTS $ProductCode
I was unable to initialize the OLDPRODUCT value at the start of the installation.
I m asking is there a workaround to set this secure custom property during an upgrade?

Thank you.
Skipping action: AI_PREPARE_UPGRADE (condition is false)
Catalin
Posts: 7664
Joined: Wed Jun 13, 2018 7:49 am

Re: Failed to set OLDPRODUCT property value

Hello,

Could you please give me some more details about how exactly you do the rollback to the previous version?

For instance, if the setup fails on instlalation of the new version, do you rollback everything and then install the previous version? Is that what you are doing in your PowerShell script?

If so, then the OLDPRODUCTS property should be set accordingly, as it is set automatically during an upgrade by Windows Installer.

Are you launching the exact same v2 that previously failed but this time it is not seen an upgrade? Is this your scenario?

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
moussaoui
Posts: 4
Joined: Mon Mar 18, 2024 10:30 am

Re: Failed to set OLDPRODUCT property value

Hello,

Initially, I create backups of all critical components such as AppDir, services, environment variables, and registry keys at the beginning of the upgrade. In case a rollback is necessary, I use a PowerShell script to restore all these elements, ensuring the product is functional again.

After that I try to run the exact same v2 that previously failed but this time it is not seen an upgrade.

Best regards
Catalin
Posts: 7664
Joined: Wed Jun 13, 2018 7:49 am

Re: Failed to set OLDPRODUCT property value

Hello,

Thank you for your followup on this!

Well, the problem we face here is that, even if you restore the files and everything else, the v1 is still uninstalled on the machine, as per the upgrade order - remove old version and install new version.

That's why v2 does not recognize v1 is installed, because it actually isn't installed anymore.

Normally, what you want to achieve (if the installation of v2 fails, revert to v1) is done through the "Install new version first and then uninstall old version" option from the "Upgrades" page.

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”