1

I have an addin application, A, built with Add-In express. Its installer is built in a Visual Studio setup project. Now I have included it in another comprehensive application, B. Its installer is built with Advanced Installer.

We want to be able to uninstall A during install of the comprehensive application B. According to Advanced Installer's user guide "How do I uninstall another MSI package when my application is uninstalled?", I follow the guide, but it does not work for me.

So I must miss something or some setting is not correct in my AIP. I am not sure how to attach aip file. How can I fix this problem?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
toosensitive
  • 2,335
  • 7
  • 46
  • 88
  • The article you cited provides instructions for removing another MSI based application when your main application is uninstalled. What you are trying to do isn't covered by that article. If the Add-In is already installed on the target machine why do you need to uninstall it before installing your main application (unless the main application is installing a different version)? – Tim Lentine Mar 15 '12 at 15:22
  • Just to be sure, you want to uninstall application A when you install application B, yes? Because in your question you are making a reference to article from Advanced Installer user-guide where it is explained how to uninstall an application during the UNINSTALL of the main app, in your case B. – Bogdan Mitrache Mar 15 '12 at 15:24
  • @Bogdan. Yes, I want to uninstall A when install B. I could not find exactly same from user guide, so I find the article which I thought I can tailor to work for my case. unfortunately I could not get it to work. Please let me know how to accomplish this. thanks – toosensitive Mar 15 '12 at 15:47
  • @Tim, A has only one function, B has multiple functions including A. So we want to uninstall A when install B. B also includes more bug fixes for A. Basically A will not exist alone any more, it is included in B. thanks – toosensitive Mar 15 '12 at 15:49
  • @Bogdan, so far I have tried the following and none works. see last post @ http://www.advancedinstaller.com/forums/viewtopic.php?f=2&t=20734&p=51062#p51062. thanks 1. created an exe (console program), run msiexec in it. then add the exe in custom action; 2. tried systemfolder, then pass in [systemfolder]msiexec.exe /x ... in custom aciton 3. created a bat file which does msiexec /x ..., call bat in custom aciton. – toosensitive Mar 15 '12 at 15:59

1 Answers1

3

The solution is very simple. Since A, from what I can see is a MSI package you can simply go to Upgrades page in Advanced Installer, for project B, and use the "New" button to add the MSI for app A to the list.

This will add the upgradecode of app A to the Upgrades table from the B package, so the OS will consider B is an upgrade for A and will automatically remove it.

Edit

Add a custom action to run something like MSIEXEC.exe /x {21D0F841-65A2-4A42-AA56-D7EF238968DE} /qn and then add an extended search (search by upgradecode), use search result to control the custom action. see more details in comments & chat

Bogdan Mitrache
  • 10,536
  • 19
  • 34
  • 2
    This is an automated support from Microsoft, so it should work. The only cases when this skips the removal is if the two packages have different install types, i.e. per-user and per-machine, or if the version of package B is smaller than the one of A. – Bogdan Mitrache Mar 15 '12 at 16:09
  • Also, I assume the option "Automatically remove older versions" is selected in Upgrades page from Advanced Installer, for package B? – Bogdan Mitrache Mar 15 '12 at 16:09
  • Yes, automatically upgrade is checked in AI. B has version 2.4.0, A has version 0.4.0. A is built to install per user. B is built to install per user or machine, default is per-machine. In this case, is it possible to unistall A when install B? – toosensitive Mar 15 '12 at 16:16
  • Using the Upgrades page it will work only if you set the install type of B to per-user too, so it matches the one of A. – Bogdan Mitrache Mar 15 '12 at 16:23
  • If you don't want to change the install type for B you could try adding a "Launch File or Open URL" predefined custom action, under Begin standard action from InstallUISequence, and set its command line field to "msiexec /x {product code}". But this custom action will run only if the install of B runs with full UI, and the user will see a basic progress dialog while A is removed, which is not very pleasant. – Bogdan Mitrache Mar 15 '12 at 16:25
  • THanks, That's right. It works when I select per-user install for B. But almost all users select per-machine (default) when install B. How can make it to uninstall A when users install B per-machine? Any ideas? thanks – toosensitive Mar 15 '12 at 16:26
  • thank you so much, Bogdan. Dummy quesiton, how to set full UI in AI? – toosensitive Mar 15 '12 at 16:28
  • As I said above, Windows does not allow an upgrade when the install types are different. So the Upgrades page cannot be used. The alternative would be to try the custom action I described above. However, my recommendation is to maintain the same install type, i.e. per-user. – Bogdan Mitrache Mar 15 '12 at 16:30
  • Full UI is set by default for all packages built with AI. Make sure you have not enabled "Limit to basic user interface" from Install Parameters page, if your package runs only with basic UI. – Bogdan Mitrache Mar 15 '12 at 16:35
  • hmm, I did not check "limit to basic user interface", so my installer is run in full UI. I tried "launch file or open URL" predefined custom aciton, does not work. It says "Another program is being installed. Please wait until that installation is complete, and then try installing this software again." – toosensitive Mar 15 '12 at 16:46
  • This couls happen if you added the custom action under InstallExecuteSequence. As you can I recommended adding it under InstallUISequence, and set to synchronous execution, wait for return. – Bogdan Mitrache Mar 15 '12 at 17:05
  • I added it under installExecuteSequence ->InstallFinalize. When I right click IstallUISequence, all predefined custom action are grey out. so I am not able to add any custom action under InstallUISequence. Is there some setting I need set to enable it? thanks – toosensitive Mar 15 '12 at 18:08
  • You need to first show a standard action, option available in the context menu, and after that right click on it and add the custom action. – Bogdan Mitrache Mar 15 '12 at 18:34
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/8944/discussion-between-toosensitive-and-bogdan-mitrache) – toosensitive Mar 15 '12 at 19:11
  • @BogdanMitrache I need to uninstall 2 application during the installation of my msi file.I coded to uninstall application programatically and called that function in installer.cs.But that is not uninstalling the application,i have raised a question in SO please look into this and guide me http://stackoverflow.com/questions/26863294/uninstall-a-application-during-installation-not-working – user2725407 Nov 11 '14 at 13:24