nalse
Posts: 5
Joined: Tue Sep 27, 2022 4:37 pm

Exclude the Product Version from The Windows Installer Registry Key & Uninstall Another Program That Does Not Use .MSI

Tue Sep 27, 2022 5:10 pm

Hello,

My company has decided to swap our product's installer from InstallAware to Advanced Installer. For the most part, I have enjoyed my time with Advanced Installer despite having to start from scratch--indeed, the support given by the employees on this board has been instrumental to the rate of progress I have sustained for this project.

However, I have two questions about Advanced Installer behavior that is not clear from either the User Guide or from forum posts I have read.

1st Question: We want to exclude the product version from the Windows Installer Registry Key for the Uninstall String. How can we do this?

Details:

We use our own service to automatically detect and upgrade when a user's product version is out of date. In InstallAware, our Uninstall String could be found under:

Code: Select all

HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\[Product Name]\UninstallString
This is convenient because we do not need to update the service's code in between product releases--we always kept the Uninstall String in the same location. However, Advanced Installer is placing the Uninstall String under:

Code: Select all

HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\[Product Name][Product Version]\UninstallString
Note the difference between the two is that our product version is now included in the Registry key.

The behavior we desire is to place the UninstallString in the previous location so that we do not need to update our update service's code with every new release. That location, for clarity, is:

Code: Select all

HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\[Product Name]\UninstallString
Effectively, we wish to exclude the product version from the Windows Installer Registry Key. How can we do this?

2nd Question: How can we silently uninstall our application's previous version that uses an .EXE installer from a non-Advanced Installer installation program?

Details:

In the guide for uninstalling another application ( https://www.advancedinstaller.com/user- ... oduct.html ), there is a section labeled "The old package is created with another tool and it is not MSI-based". This is the case for our old InstallAware application: it is an .EXE-based installer. Specifically, the guide says to create a custom action to uninstall the old application after the "Preparation" step:
Since the old product should be removed before the new installation takes place, the custom action can use the condition NOT Installed and be scheduled straight under the "Preparing" action group.
For full clarity, I used a "Launch EXE with working directory" custom action to launch the .EXE installer using the UninstallString from the registry. When I attempted to follow the steps in this guide, however, both the installation of the new version and the uninstallation of the old version would attempt to run concurrently, which caused both to hang because Windows only allows one installation/uninstallation to occur at a time. I found a workaround by placing the custom action that uninstalls the previous version after "User Selection" in the "Wizard Dialogs Stage," but this has unfortunate side effect of causing the uninstall step not to execute during a silent installation from the Advanced Installer installation. Since most of our installations are performed silently via our automatic upgrade service, this is a major problem because we effectively cannot silently uninstall the old application. How can we silently run the previous version's uninstaller without causing the installation process to hang?

For clarity, here is a picture of my current installation steps setup:
Screenshot 2022-09-27 110831.png
Screenshot 2022-09-27 110831.png (21.79KiB)Viewed 9823 times

nalse
Posts: 5
Joined: Tue Sep 27, 2022 4:37 pm

Re: Exclude the Product Version from The Windows Installer Registry Key & Uninstall Another Program That Does Not Use .M

Wed Sep 28, 2022 4:32 pm

For the time being, I have found a workaround to my first question. We write values into a registry key dedicated to our program, so all I have to do is write the product code into that registry key under a new value and use that value to find the uninstall string when it's needed later.

I do not find this solution to be that elegant, though, so I would still like to know if it's possible to exclude the version number from our key in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

In fact, the ideal scenario would be the ability to use a consistent Product Code across versions. InstallAware uses 3 GUIDs for Windows Installer: Product Code, Version Code, and Revision Code. From what I have read, Advanced Installer also uses 3 GUIDs for Windows Installer: Product Code, Version Code, and Package Code. InstallAware's Revision Code is equivalent to Advanced Installer's Package Code in that it changes every time a build is executed, which makes me wonder why Advanced Installer requires the Product Code to change in between versions. Advanced Installer claims that the Product Code must be unique, but I just installed an old installer (from InstallAware) of our product from 2014, and the Product Code is exactly the same as our most recent release. I have to wonder if it is actually a limitation of Windows Installer as Advanced Installer claims in the numerous forum posts regarding being unable to run the installer because "a previous installation exists on the machine."

nalse
Posts: 5
Joined: Tue Sep 27, 2022 4:37 pm

Re: Exclude the Product Version from The Windows Installer Registry Key & Uninstall Another Program That Does Not Use .M

Wed Sep 28, 2022 9:09 pm

Another follow-up: I have discovered a far-less-than-ideal workaround for uninstalling installations of our program that use our old installer. It involves using a .bat file as a pre-requisite per this thread: viewtopic.php?t=33947

This is less than ideal because it entirely defeats the purpose of a silent install to have a command line prompt appear on the user's screen. Our automatic updater is meant to run completely silently in the background, without any interaction from or interruption to the user. However, the need to use a .bat to uninstall our old program means that the installation will disrupt the user with a command prompt appearing seemingly out of nowhere, and although the interruption lasts for a reasonably brief period of time, the goal is to be able to upgrade with zero interruption.

I would still like to understand the proper way to uninstall another program that does not use .MSI for its installer. I post these workarounds because they may help other users in the future, but these are not workarounds with which I am satisfied

Catalin
Posts: 6511
Joined: Wed Jun 13, 2018 7:49 am

Re: Exclude the Product Version from The Windows Installer Registry Key & Uninstall Another Program That Does Not Use .M

Thu Sep 29, 2022 10:34 am

Hello and welcome to our forums,

First of all, thank you for your interest in Advanced Installer and I am glad to see you are pleased with our product and its support so far!

Regarding the first question, I am not quite sure I fully understand it.

Are you sure that a setup created with Advanced Installer places its UninstallString under the following:

Code: Select all

HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\[Product Name][Product Version]\UninstallString
I am asking this because, as per my knowledge, that key is created automatically by the Windows Installer (the technology Advanced Installer is built upon and most likely, InstallAware too). This is not something we control from within Advanced Installer.

In fact, I've run a little test just now and the key is created as expected, like this:
Screenshot_5.png
Screenshot_5.png (208.07KiB)Viewed 9757 times

Where, as you can see, that is the ProductCode defined in the Advanced Installer project:
Screenshot_6.png
Screenshot_6.png (52.34KiB)Viewed 9757 times

Regarding the second question, please have a look on the following article which my colleague Liviu recently wrote:


How to upgrade an older version of the package created with another tool and it is not MSI-based

where it is explained, step-by-step, how to achieve this.

Hope that helps!

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

nalse
Posts: 5
Joined: Tue Sep 27, 2022 4:37 pm

Re: Exclude the Product Version from The Windows Installer Registry Key & Uninstall Another Program That Does Not Use .M

Fri Sep 30, 2022 5:43 pm

Hello Catalin,

Thank you for the reply. I have read through your post, and unfortunately, neither of my questions has been resolved yet.

I will start with your response to my second question first because the workaround I have in place to solve this issue is not fit for deployment and thus requires more immediate attention:
Regarding the second question, please have a look on the following article which my colleague Liviu recently wrote:


How to upgrade an older version of the package created with another tool and it is not MSI-based

where it is explained, step-by-step, how to achieve this.
I followed the guide, and before I explain the outcome that occurred, I would point to this line written in that guide:
8. Now you can use the search property to trigger the uninstall of the old package. For that, go to the "Custom Actions" page and add a "Launch File" custom action scheduled after "Searches" action group in the Wizard Dialogs stage or Install Execution Stage.
I tried placing the custom action in both places. When I place the custom "Launch File" action after "Searched" in the Install Execution Stage, both my uninstallation and installation still hang, as I described in my original question. In fact, it is the exact same behavior I saw when I placed the "Launch EXE with working directory" custom action immediately after the "Preparing" step, as I described in my initial post.

As for the other suggested location, it was a similar experience to what I described in my original post. Placing the custom "Launch File" action after "Searches" in the Wizard Dialogs stage means that the custom action is never executed when installing our new Advanced Installer version silently, and thus our old version is not uninstalled during a silent installation. Unfortunately, the guide you linked has not helped me to achieve the desired result.

Our old installer is another .EXE bootstrapper, so perhaps the solution in these guides does not work because the installer is using its underlying .MSI during the uninstall while the Advanced Installer bootstrapper is also running its own .MSI install? I know that only one install/uninstall can run at a time on Windows, but I do not know how to use the combination of all this information to run our previous version's uninstaller successfully in all scenarios.

Regarding my first question, you asked:
Are you sure that a setup created with Advanced Installer places its UninstallString under the following:
[snippet]
I am asking this because, as per my knowledge, that key is created automatically by the Windows Installer (the technology Advanced Installer is built upon and most likely, InstallAware too). This is not something we control from within Advanced Installer.
Yes, I am certain. You are also correct, however, that another value is written to a key utilizing the Product Code set in Advanced Installer. Unfortunately, the Product Code does not achieve my desired result because Advanced Installer requires that code to change in between releases. As I explained in one of my follow-up posts, this requires me to use a method that I do not consider to be particularly elegant: writing the Product Code to our product's Registry Key so our update service can look it up later. This workaround is functional but inelegant in my opinion.

Thus, it would be ideal to use this GUID, but I encounter the exact same issue here as I would in using the Registry Key I pointed to: It changes in between every release. If we could keep the product code consistent across releases--something that we have been doing for the better part of a decade with InstallAware without issue--then that would solve my issue. The reason I pointed to the Registry Key that uses our program's name instead of the Product Code was because I figured I would have more luck asking this forum how to exclude the product version from the Registry Key rather than how to keep the Product Code consistent across releases.

If there is indeed a way to keep the Product Code consistent across releases without then causing this error message to appear from Windows Installer when an upgrade is attempted:
error.jpg
error.jpg (34.29KiB)Viewed 9665 times
please do inform me of how to do this. This is the ideal solution in my case, but I wrote my original question under the assumption that it was not possible.

Catalin
Posts: 6511
Joined: Wed Jun 13, 2018 7:49 am

Re: Exclude the Product Version from The Windows Installer Registry Key & Uninstall Another Program That Does Not Use .M

Tue Oct 04, 2022 11:52 am

Hello,

If possible, could you please forward me the following resources:

- a download link for the old version (created with InstallAware)

- a download link for the newer version (created with Advanced Installer)

- a copy of your .AIP file (used to build the Advanced Installer setup)

by email at support at advancedinstaller dot com so I can further investigate their settings and do some testing on my end?
If there is indeed a way to keep the Product Code consistent across releases without then causing this error message to appear from Windows Installer when an upgrade is attempted:
Regarding this, I'm afraid it is not possible, as that message is thrown by the Windows Installer.

Product Identification (ProductCode and UpgradeCode)



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

nalse
Posts: 5
Joined: Tue Sep 27, 2022 4:37 pm

Re: Exclude the Product Version from The Windows Installer Registry Key & Uninstall Another Program That Does Not Use .M

Wed Oct 05, 2022 5:58 pm

Hello Catalin,

All of the existing download links I could provide are not ones readily accessible by the public, and I am unsure where I could upload these files privately for AI's support to download.

That being said, I believe I have found a satisfactory workaround: I can run our old .EXE installer as a pre-requisite and with the command line switches "/x /s" to silently run the uninstall.

My initial testing showed that this removes every version from our current major release version, which I anticipate to be more than good enough for most of our customers who elect to use our auto-updater. The only downside here is that the old installation remains listed in the registry for some reason, but I can simply use the information in this thread ( viewtopic.php?t=24824 ) to delete that key upon starting the new version install.

As for the Windows Installer registry key, I am still using the workaround I described earlier. I have ideas for more elegant solutions, but I do not anticipate needing to try to implement them.

Despite all this, I would still be open to providing the files for you to download because I would still like to know how to perform the uninstall of the old version correctly. I simply do not know where I could do this so only you or one of your colleagues could download it.

Catalin
Posts: 6511
Joined: Wed Jun 13, 2018 7:49 am

Re: Exclude the Product Version from The Windows Installer Registry Key & Uninstall Another Program That Does Not Use .M

Thu Oct 06, 2022 12:26 pm

Hello,

First of all, thank you for your followup on this.

I am glad to hear you managed to solve the problems you encountered. Thank you for sharing your solution with us.

Regarding the files, please note I have sent an email with a link where you can upload the files.

Let's continue the thread over the email.

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

Catalin
Posts: 6511
Joined: Wed Jun 13, 2018 7:49 am

Re: Exclude the Product Version from The Windows Installer Registry Key & Uninstall Another Program That Does Not Use .M

Fri Oct 07, 2022 1:38 pm

Hello,

I have replied to you over the email.

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

Return to “Common Problems”