How to prevent "Upgrader" from taking any action. - Advanced Installer Community
VassilisM
Posts: 5
Joined: Tue Feb 14, 2023 12:51 pm

How to prevent "Upgrader" from taking any action.

Hello.

Our target was to being able installing any product version on top of any other product version. Ideally with the same product code; searching around, we found out that this is not possible, so a new product code will be unavoidably provided. This thing runs in Azure, so upgrading the version and the product code on the fly, is a hack editing the .aip before the task is called. The project is currently appxbundle bootstrapped in exe.

So, to the matter at hand. We would like to take care of the uninstallation of all the previous versions ourselves and we would like Advanced Installer to take no action about it. The settings in the "Upgrades" view are, at the moment: "Allow side by side installs of different product versions".
According to the tool-tip below at the "Order" group:
Information
The upgrade order has effect only when "Automatically
upgrade older product versions" is selected. The settings
will be saved but it will have no consequence.
The thing is... that it does have a consequence.
In our example, installed is the "1.11.1.2356" and next comes the "1.11.1.2358". Please don't mention about the fourth number and the windows installer relationship, because a manual "install, uninstall, install", works perfectly... That is what we would like to reproduce using Advanced Installer.

"Uninstall old version first and then install the new version" will: uninstall the "1.11.1.2356" leaving some registry keys (not left with manual uninstallation) and while this will be uninstalled, leaving the "1.11.1.2358" installed in its spot in the control panel, the version that will run will be the "1.11.1.2356". Searching the registry there are double keys. A second installation of the "1.11.1.2358" will fix it.

"Install new version first and then uninstall old version" will: let us uninstall whatever we find ("1.11.1.2356") and will install the "1.11.1.2358". If we launch it before Advanced Installer goes to "Uninstalling previous versions", it will be the "1.11.1.2358", the one that it should be. After AI finishes though, the control panel will still show the "1.11.1.2358" but it will be nowhere to be found.

So, you see, if we have "Allow side by side installs of different product versions" we do not want it to check for us and take action. We do not want it to uninstall in any order. It is possible?

Thank you in advance.
Vassilis
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: How to prevent "Upgrader" from taking any action.

Hello Vassilis and welcome to our forums,
Please don't mention about the fourth number and the windows installer relationship, because a manual "install, uninstall, install", works perfectly... That is what we would like to reproduce using Advanced Installer.
Although you don't want to hear about this, please note that using the 4th field goes against the best practices of Windows Installer and may result in unexpected behavior.

Now, considering your scenario, perhaps your best bet would be to simply change the UpgradeCode between upgrades? If two setups do not have the same UpgradeCode, the Windows Installer will simply think they are different products and will not even attempt to perform an upgrade.

You can then do the manual uninstall or the programmatic one, as per your needs.

Product Identification (ProductCode and UpgradeCode)

We need to make sure, however, that the two setups are installed in different paths.

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
VassilisM
Posts: 5
Joined: Tue Feb 14, 2023 12:51 pm

Re: How to prevent "Upgrader" from taking any action.

Hello Catalin and thank you for your answer.

Changing the upgrade code as well works indeed. But as a side-effect the old msi remains under the windows\installer, with all of the consequences; the system thinks that it has the two versions installed, uninstalling either, will make it inaccessible for the user.
The thing with changing the path though, not sure. That would mean to change the package name as well with each new build, since the appxbundle will install itself under a predefined path.
For the version, we set the fourth number to 0 when we release. But for all the testing in the meantime, the fourth is the only one it changes. So to change these codes just for a debug build is too much of a trouble. Unavoidable nevertheless.

Regarding the whole thing, what you're telling us, is that there is absolutely no way to use the same product code and upgrade code to advance to the next version (defined only by any change in the first three numbers?)* without getting weird installer messages like that the product is already installed? We tried tweaking the parameters "Install MSI as minor upgrade" and "Uninstall a package with the same version" and tried (almost?) all the combinations for the two different versions, but nothing worked.

What we want to accomplish: "Install a sideload next or previous version as provisioned for all users (UAC) while keeping the settings of each user and having only one version installed at any time".

*Building a new msi I guess changes the package code automatically?

PS: Do you know if everybody using AI, or similar products, have to write their own custom actions for just installing an appxbundle and some appx dependencies?

Kind regards,
Vassilis
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: How to prevent "Upgrader" from taking any action.

Hello Vassilis,
Regarding the whole thing, what you're telling us, is that there is absolutely no way to use the same product code and upgrade code to advance to the next version (defined only by any change in the first three numbers?)* without getting weird installer messages like that the product is already installed? We tried tweaking the parameters "Install MSI as minor upgrade" and "Uninstall a package with the same version" and tried (almost?) all the combinations for the two different versions, but nothing worked.
I'm afraid not. This is simply how the Windows Installer has been designez and since our product is based on that technology, there is nothing we can do here.
*Building a new msi I guess changes the package code automatically?
If you build a new MSI from scratch, then it will have new ProductCode and UpgradeCode properties.

If you increase the version, you will be asked whether if you want or not to change the ProductCode, depending if you further need to deploy either a patch or a major upgrade.
PS: Do you know if everybody using AI, or similar products, have to write their own custom actions for just installing an appxbundle and some appx dependencies?
Not quite sure I understand this question.

PowerShell has some predefined cmdlets that work with appx packages, e.g.: Add-AppxPackage


Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
VassilisM
Posts: 5
Joined: Tue Feb 14, 2023 12:51 pm

Re: How to prevent "Upgrader" from taking any action.

Hello again.
I'm afraid not. This is simply how the Windows Installer has been designez and since our product is based on that technology, there is nothing we can do here.
I was afraid of that. That is most unfortunate...
If you build a new MSI from scratch, then it will have new ProductCode and UpgradeCode properties.
I think not necessarily, only if they change in the AIP file. I was talking about the package code. It has to be automatically generated, since there is no way for a user to see or adjust it.
If you increase the version, you will be asked whether if you want or not to change the ProductCode, depending if you further need to deploy either a patch or a major upgrade.
The version gets automatically hacked into the file in the azure pipeline just before building, publishing and packaging, and gets determined from the general assembly version and the git branch. So a new product code GUID must be put in there on the fly as well I suppose.
Not quite sure I understand this question.
Since we "inherited" this project, we are trying to make sense of the installation process ourselves. What I meant is that we are using the "Add-AppxProvisionedPackage ..." to actually install. But that is done in a custom action. If we omit it, nothing gets installed. I am not sure that installing and uninstalling should go through the "custom actions" to actually run powershell. But if not, do you know how else?

Very well, back to the original question. Why does the upgrader take the radio button option into consideration if the tooltip says that it will not affect anything?

Best regards,
Vassilis.
VassilisM
Posts: 5
Joined: Tue Feb 14, 2023 12:51 pm

Re: How to prevent "Upgrader" from taking any action.

Oh sorry, another thing:
If you increase the version, you will be asked whether if you want or not to change the ProductCode, depending if you further need to deploy either a patch or a major upgrade.
Why should a major or patch play a role? We generate a new appxbundle from scratch, even for a small change. There we only change the third number of the version.
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: How to prevent "Upgrader" from taking any action.

Hello Vassilis,
I think not necessarily, only if they change in the AIP file. I was talking about the package code. It has to be automatically generated, since there is no way for a user to see or adjust it.
I'm sorry for my misunderstanding here. The PackageCode is a GUID, just like the ProductCode and UpgradeCode properties are.

The PackageCode is generated each time you build your setup and this should never be the same between two packages unless those two are identical.

Basically, you can think of this like some sort of a checksum.
Since we "inherited" this project, we are trying to make sense of the installation process ourselves. What I meant is that we are using the "Add-AppxProvisionedPackage ..." to actually install. But that is done in a custom action. If we omit it, nothing gets installed. I am not sure that installing and uninstalling should go through the "custom actions" to actually run powershell. But if not, do you know how else?
Ok, it makes sense now. Unfortunately, I can not really say why the previous developer chose this approach, either.

It looks like the developer simply created a boostrapper over tha APPX file that installs it through a custom action, something like this:

How do I sideload an APPX package using an MSI?

In your case, your setup simply copies the APPX file on the target machine. You then need to install it through a custom action.

Perhaps the previous developer had the setup as APPX but had the request to deliver it as EXE? If that's the case, then indeed this is the easiest approach.

Basically your workflow right now is like this:

- you install your EXE --> all this does is copy on the disk the APPX file and then install it through the custom action

- you install the newer version of the EXE --> this removes the previous version (which is basically empty anyway, only the APPX file) --> this once again copies the file, launches it and the new version of the APPX file will automatically remove the previous version of the APPX file and then install ontop, as the upgrade scenario is supported by default in the APPX/MSIX packages.
Why should a major or patch play a role? We generate a new appxbundle from scratch, even for a small change. There we only change the third number of the version.
Please see above for the explanation. In our case, we basically need to have a major upgrade, so the old APPX we have copied gets removed and then the new one gets copied over. I'm pretty sure a patch is not even compatible with this scenario.

Even if you manage to install your two EXE's side by side, I'm pretty sure that when you launch the APPX from the newer EXE, it will automatically remove the APPX from the previous version.

Hope this has shed some light over this subject and your scenario!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
VassilisM
Posts: 5
Joined: Tue Feb 14, 2023 12:51 pm

Re: How to prevent "Upgrader" from taking any action.

Hello Catalin and thank you for taking the time to answer.

To clarify, I chose to make it an .exe in order to elevate UAC by default. The project previously had only an .msi, both sideload and store. Store was dropped. And to install? Run cmd or ps as administrator and then msiexec /i ... with some parameters. I bootstrapped everything in the exe t make that easier. The thing is:
this once again copies the file, launches it and the new version of the APPX file will automatically remove the previous version of the APPX file and then install ontop, as the upgrade scenario is supported by default in the APPX/MSIX packages.
That would be ideal and yes that is what we would like to achieve. Though, cannot yet. If you say it is possible, I will try more parameter combinations. If it does not succeed, I will keep this scenario:

My latest approach is to skip registering with windows installer. The only side effect is that we cannot see it in the control panel anymore and there is no way to uninstall unless we add a parameter in the .exe to actually call the uninstall script only. Unfortunately the user "uninstall" from start menu cannot be blocked...

Anyway, thank you very much for your time and effort. I got some useful hints. Much appreciate it!

Best regards
Vassilis.
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: How to prevent "Upgrader" from taking any action.

You are always welcome, Vassilis!

I am glad I was able to assist here.

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

Return to “Common Problems”