Nova_Max
Posts: 3
Joined: Wed Mar 06, 2024 11:09 pm

Major Upgrade Failing During Silent Install (winget)

Hello,

Previously I was using a Visual Studio Setup project to create my installer. i have now switched to Advanced Installer. To allow people to update the old installation with the new installer I have used the same upgrade code.
When manually running the installer in UI mode the major upgrade works as expected.
I only ran into problems when trying to set up the new installer for winget where the new version is installed but the old version is not removed properely. I was able to reproduce the issue by running the installer in reduced UI mode /qb /passive so it's not a problem with winget.

Any ideas why this could be happening?

Here is the AI project: https://github.com/tommaier123/XBattery ... Status.aip
And the installer: https://github.com/tommaier123/XBattery ... tag/V1.3.2
And the winget manifest: https://github.com/tommaier123/winget-p ... atus/1.3.2
Liviu
Posts: 1048
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Major Upgrade Failing During Silent Install (winget)

Hello and welcome to our forums,
I only ran into problems when trying to set up the new installer for winget where the new version is installed but the old version is not removed properely.
This happens when the old version is installed per-user. The new version you created is per-machine.

Please note that a per-user installation cannot upgrade a per-machine installation, and a per-machine installation cannot upgrade a per-user installation.

To uninstall the older versions of your product, no matter what Installation Type they use (per-user or per-machine) you can use our Uninstall previous versions custom action. This custom action must be scheduled before "Wizard Dialogs Stage" -> "Paths Resolution". This way it will run right before the installation starts. The custom action uses the package's UpgradeCode to find the older versions. However, this does not work for silent installation.

This is a complicated case and I'm afraid we don't have a proper solution for it. You can use a custom action with a batch script and the end of installation to call the uninstall of older versions (msiexec /x {ProductCode}), but there are several problems. Both versions install the files in the same location, and if you uninstall the old version at the end, it will delete many of those files added by the new version, so they should be installed in different locations.

You cannot call the uninstall at the start of the installation during Silent UI, because two MSI installations cannot run at the same time.

The same problem happens if you install with UI, and the old version was a per-user install. However, in this case, our predefined custom action of removing older versions will work as expected.

Hope this helps!

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Nova_Max
Posts: 3
Joined: Wed Mar 06, 2024 11:09 pm

Re: Major Upgrade Failing During Silent Install (winget)

Liviu, thanks for the help.

Your explanation makes a lot of sense. But I am wondering why it works during normal UI installation.
I don't currently have a custom action to uninstall the previous version.

As for installing per user, the old installer had that option but I don't think it ever worked. I tested both cases with the new installer and both upgraded fine.

Good to know though that this should not be an issue in the future as I have now limited the installer to per machine installation.
Liviu
Posts: 1048
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Major Upgrade Failing During Silent Install (winget)

You're always welcome!
But I am wondering why it works during normal UI installation.
Good to know though that this should not be an issue in the future as I have now limited the installer to per machine installation.
From my tests it didn't work with UI either. I installed the old version per user, and the new version per machine. The result was that the old version was not uninstalled and both were visible in the Control Panel.

Indeed, this should not be a problem in the future.

Let us know if you encounter any issues and we will gladly assist.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Nova_Max
Posts: 3
Joined: Wed Mar 06, 2024 11:09 pm

Re: Major Upgrade Failing During Silent Install (winget)

Hi Liviu,

thanks for testing.
Liviu wrote: Mon Mar 11, 2024 3:11 pm From my tests it didn't work with UI either. I installed the old version per user, and the new version per machine. The result was that the old version was not uninstalled and both were visible in the Control Panel.
Strange. I just tested it again and for me it works in UI mode even if the previous install was per user.
Did you change the install path while installing with the old installer? For me the old installer uses the per machine path no matter which scope is selected.

Can you test upgrading the per machine install in reduced UI mode? That should work right? But it doesn't on my end.

Best regards
Max
Liviu
Posts: 1048
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Major Upgrade Failing During Silent Install (winget)

Hello Max,
Did you change the install path while installing with the old installer? For me the old installer uses the per machine path no matter which scope is selected.
I think that was the cause, yes. I had the app installed in the AppData folder. I retested this and indeed it works with the Full UI.
Can you test upgrading the per machine install in reduced UI mode? That should work right? But it doesn't on my end.
This is the same case as for silent installation. The actions start directly with the Install Execution Stage and the Wizard Dialogs Stage is skipped. This is the expected behavior not to work.

Let me know if you have any other questions.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”