donalwa
Posts: 10
Joined: Wed Jun 15, 2016 4:26 pm

Is it possible to call a c# app that will call other msi files to uninstall , as part of the uninstall of my app?

Hi
I am investigating:
Is it possible for my "Advanced Installer" installer to call a c# app that will call msi files to uninstall in a certain order?

I am wondering if i would be blocked by the rule that only one msi can run at a time on windows (2012 R2)?
However: Our installer includes pre-reqs that i notice are being uninstalled when the main application is uninstalled via add\remove programs.

So i am wondering if during uninstall (or major upgrade) i could call a custom action that would then call my c# app that would uninstall other msi files (the other msi files are custom patches that were not installed originally with the base installer)

Thanks
Regards
Donal
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Is it possible to call a c# app that will call other msi files to uninstall , as part of the uninstall of my app?

Hello Donal,

You should be able to achieve this in two ways:

1. by calling your C# app through a custom action scheduled anytime during the "Wizard Dialogs Stage" in "Custom Actions" page

2. by calling your C# app through a custom action scheduled only after "Install Execution Stage -> Finish Execution" action group; the custom action must have the "Wait for custom action to finish before proceeding" and "Wait for return code at the end of the sequence" execution options disabled - this way the custom action will be launched asynchronously and the second uninstall process won't overlap with the main installation process, thus avoiding the limitation that only one MSI installation process (the Install Execution Stage) can run at a time

Also have a look on our "How to create fully fledged C# custom actions" article to check how you can write and integrate in the setup a C# app.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
donalwa
Posts: 10
Joined: Wed Jun 15, 2016 4:26 pm

Re: Is it possible to call a c# app that will call other msi files to uninstall , as part of the uninstall of my app?

Thank you for that information Daniel.

In my case the uninstall of the main installer is dependent on the return code of the custom action that calls the other msi installer to uninstall.
Does that rule out both ways mentioned below (in my case)?
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Is it possible to call a c# app that will call other msi files to uninstall , as part of the uninstall of my app?

Hello Donal,

In this case you can still try to use the first approach. For instance you can proceed like this:

1. go to "Product Details" page and check the "Override Windows Installer program list entry" and "Use a single "Uninstall/Change" button instead of separate buttons for each operation" option; this way the uninstall operations from control panel will be always launched with full UI

2. go to "Custom Actions" page and add your C# custom action as a custom action without sequence

3. go to "Dialogs" page and add on a dialog from "Maintenance" section an "Execute action" event which will trigger your C# custom action

This way each time the uninstall process is launched by executing the setup package or through Control Panel, the setup package will be launched with full UI and the C# custom action will be executed.

However, please note that the above approach works as long as the uninstall operation is launched with full UI. To prevent the scenario when the uninstall process is launched silently (e.g. by calling the setup package silently with an uninstall command line) you can create a custom action which will trigger an error to prevent the silent uninstall process. The custom action should use the following condition:

Code: Select all

(REMOVE = "ALL" AND UILevel <> "5")
Hope this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”