scrouchman
Posts: 12
Joined: Fri Aug 07, 2009 1:42 pm

Prevent uninstaller launching custom action

Hi,

We have gotten ourselves in a bit of a situation and im hoping there is a way out of it.
We have released a version of the software that has a custom action on uninstall. We are now preparing to release a new version which users should be able to upgrade to, however when running the upgrade its uninstalling the old version which is running our custom action. I know how to prevent this for future updates but we need a way of stopping it running this time round. Is there anything we can do?

Thanks,

Steve.
MindTooth
Posts: 37
Joined: Mon Aug 17, 2009 12:40 am

Re: Prevent uninstaller launching custom action

This is no help-reply. But I am more curious what the custom action was, and how you can solve this is future versions. Still learning AI you know :) (If the custom action reveals to much info. regarding your product, you can just ignore this question.)
I hope you get the help you need :D Happy codin'.

Birger :)
scrouchman
Posts: 12
Joined: Fri Aug 07, 2009 1:42 pm

Re: Prevent uninstaller launching custom action

It was to remove settings for our application, obviously if we are doing an upgrade this is a waste of the users time when they have to re enter it all again.
You can check the UPGRADINGPRODUCTCODE property to see if your doing an upgrade or not, so the newer version will only run the custom action if its doing a full uninstall and not just doing an upgrade.

Steve.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Prevent uninstaller launching custom action

Hi Steve,

Unfortunately Windows Installer doesn't support stopping a custom action from another installer. However, you can try this workaround:
- use the project of the original package to modify the custom action condition
- rebuild the old package with the modified condition
- create a new project for a new installer (this will be an update to the original install)
- in this new installer add the modified old MSI in the "Files and Folders" page (preferably in the "Temporary" folder)
- in the Custom Actions page create a new Exe with working Dir custom action under "InstallExecuteSequence" -> "Install"
- set "SystemFolder" (Windows Volume\Windows\System) as the working directory
- configure it to run a command which looks like this:

Code: Select all

msiexec.exe /fv "[#package.msi]"
- where you replace [#package.msi] with a reference to the MSI you added in the project (you can use the "Edit..." button to add it)
- make sure that the Asynchronous execution, do not wait for return option is used
- under "InstallExecuteSequence" -> "InstallFinalize" add another "Exe with working Dir" custom action
- set "SystemFolder" as the working directory
- configure it to run this command:

Code: Select all

msiexec.exe /x [ProductCode] /qb
- make sure that the "Asynchronous execution, do not wait for return" option is used
- set the custom action condition to:

Code: Select all

(Not Installed)
- in the Install Parameters page enable the "Limit to basic user interface (simple progress and error handling)" option

When this new package runs on the target machine it will copy the modified old MSI into a folder. From there the first custom action will recache the old MSI to fix the uninstall custom action. The second custom action will uninstall the new package, removing the copied MSI. Also, everything is done using progress bars, so it look like an update is being performed.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
scrouchman
Posts: 12
Joined: Fri Aug 07, 2009 1:42 pm

Re: Prevent uninstaller launching custom action

That sounds similar to the workaround I found but it doesnt work when I try and merge the 2.

The product version of the aip has been changed so I cant quite do what you suggested. What I did was extract the msi, cab and mst from the bootstrapper of the older version, modified the transform with ORCA to set it to not run the custom action, then tried running msiexec /fv with the msi and new transform. It shows something happening but doesnt actually do anything.
What I was planning on doing is overwriting the transform in C:\Windows\Installer which does work but has the problem with admin rights. I'm hoping I can use your /fv method to get round that, is there anything obvious I am doing wrong?

Steve.
scrouchman
Posts: 12
Joined: Fri Aug 07, 2009 1:42 pm

Re: Prevent uninstaller launching custom action

I think I have found a solution that appears to be working with my brief testing.

I have taken the original msi and mst from the bootstrapper, modified the mst to never run the uninstall custom action and then applied this so the msi and generated a new one. Using this msi on an installed machine I executed msiexec /fv /qn setup.msi, after which point I can run the new installer that correctly removes the installed version and installs the new one without the custom action running.

Steve.

Return to “Common Problems”