assafka
Posts: 9
Joined: Tue Oct 25, 2016 9:02 am

Uninstall old product with custom property

Hi all.
I'm trying to uninstall old version before the installation.
The uninstall command should receive custom property.
For example, the uninstallation of the old product is possible by:
msiexec /x {GUID} PASSWORD=1234

I tried to accomplish it thru "Product Information - Upgrades" but I cant set custom property for the uninstallation.
I also tried to accomplish it thru custom action, but setting the custom action in "Wizard Dialogs Stage" will not work under silent installation.
Setting the custom action under "Install Execution Stage" is failing because msiexec.exe is already running.

There is another way doing it ?
Thanks in advance,
Assaf
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Uninstall old product with custom property

Hello Assaf,
There is another way doing it ?
Yes, but it implies you uninstall the old version after the installation. You could schedule the custom action custom action after "Install Execution Stage" -> "Finish Execution" action group.

The solution is presented in this article but for uninstall:
How do I uninstall another MSI package when my application is uninstalled?

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
assafka
Posts: 9
Joined: Tue Oct 25, 2016 9:02 am

Re: Uninstall old product with custom property

Thanks for the fast reply.
But, I'm trying to uninstall the same product (older), so the files/registry files/services are the same.
Trying your solution will leave the application "installed", but everything is deleted due to the uninstall.

Is there any way we can run our code before the Install Execution Stage (in silent install, before the msiexec that is).

Another question, when the Upgrade action starts, how is the older MSI uninstalled? we thought it was a basic "msiexec /x {product code} /qn"
but it doesn't look like it.

Thanks again,
Assaf
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Uninstall old product with custom property

Hello Assaf,

I see what you mean. Unfortunately there's no way to uninstall the previous version while setting a property using the Upgrades page.
Is there any way we can run our code before the Install Execution Stage (in silent install, before the msiexec that is).
Generally it is not a best practice to uninstall any product silently without the user's consent. This is most likely the reason for the limitation to set installer properties while uninstalling silently using the predefined Windows Installer support from Upgrades page (Upgrade Code based). Moreover, mandatory uninstall properties like password or serial should be set manually by the user from the UI.

You could try something else but it's a bit tricky/hacky: create a wrapper pre-install prerequisite installer that executes the uninstall custom action (from the article I linked in my earlier posts) before the main install. Let me know if you want to try this so I can give you some more details about the settings.
Another question, when the Upgrade action starts, how is the older MSI uninstalled?
To put in context you can follow the Windows Installer Standard Actions article. First FindRelatedProducts from Searches group is executed, then RemoveExistingProducts from Preparing group.
Since two MSI processes cannot run at the same time and RemoveExistingProducts standard action is executed during Install Execution Stage, Windows Installer uses a different approach internally.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”