Reputation: 6462
Visual Studio 2010 Setup project.
How I can remove all previous versions before installing the new one in that case:
I can restrict the new version installation to install ME only or FORALLUSERS.
But I need the new version must remove any installed (ME/FORALLUSERS) before installation.
What need to correct in MSI?
Upvotes: 1
Views: 2915
Reputation: 1347
Considering that all versions of a product installation are identified by an UpgradeCode, as a workaround you can try to create a custom action which acts like this:
launch an uninstall command line like this:
msiexec.exe /x ProductCode
where the ProductCode is the ProductCode returned by the "MsiEnumRelatedProducts" function.
I haven't tested this implementation, but accordingly to Windows Installer docs it should work.
Upvotes: 1
Reputation: 55581
Windows Installer can only remove previous versions of the same time. Per-Machine removes previous Per-Machine and Per-User removes previous Per-User (same user profile). Mix and match is not possible.
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.
Upvotes: 4