WiX Toolset Version: 3.11.2.4516
To switch from a per machine to a per user installation, I changed my WiX configuration from this:
<Product Id="*" Name="$(var.ProductName)" Language="1033" Version="1.0.0.1"
Manufacturer="$(var.CompanyName)" UpgradeCode="eec853e6-9345-4be0-908f-958f212c6f30">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated" />
<MajorUpgrade Schedule="afterInstallInitialize"
DowngradeErrorMessage="A newer version of $(var.ProductName) is already installed" />
To this (remove Package/@InstallScope
and Package/@InstallPrivileges
):
<Product Id="*" Name="$(var.ProductName)" Language="1033" Version="2.0.0.0"
Manufacturer="$(var.CompanyName)" UpgradeCode="eec853e6-9345-4be0-908f-958f212c6f30">
<Package InstallerVersion="200" Compressed="yes" />
<MajorUpgrade Schedule="afterInstallInitialize"
DowngradeErrorMessage="A newer version of $(var.ProductName) is already installed" />
Now the product is installed per user instead of per machine. But the <MajorUpgrade>
doesn't work anymore. I also tried to change the Product/@UpgradeCode
to a new GUID and add the following to my WiX config (below the <MajorUpgrade>
element):
<Upgrade Id="eec853e6-9345-4be0-908f-958f212c6f30">
<UpgradeVersion OnlyDetect="no" Property="OLD_SERVICE_INSTALLER_FOUND" Minimum="0.0.0.0" />
</Upgrade>
But that doesn't work either.
How can I uninstall the old version of my software, if I switched from per machine to per user installation?
Your stuck. This is a windows installer limitation.
https://learn.microsoft.com/en-us/windows/win32/msi/major-upgrades
Note
If an application is installed in the per-user installation context, any major upgrade to the application must also be performed using the per-user context. If an application is installed in the per-machine installation context, any major upgrade to the application must also be performed using the per-machine context. The Windows Installer will not install major upgrades across installation context.