First we need to set RemovePreviousVersion property to True. We also have to ensure the value of UpgradeCode in both versions are the same when RemovePreviousVersion is set to true.
The installer checks UpgradeCode and ProductCode properties to determine whether the earlier version should be removed. The UpgradeCode must be the same for both versions; the ProductCode must be different.
"Just for me" upgrade cannot remove a previous version if it was installed for Everybody.
In the MSI generated by VS.Net, the logic for "RemovePreviousVersions" is to look for all the products with the same upgrade code with version between 1.0.0 and the version of the current product. Note this is a limitation. It should be between version 0.x.y and the current version. In this instance, you can use
Orca MSI editor to change VersionMin.
Quote:VersionMin
Lower boundary of the range of product versions detected by FindRelatedProducts. Enter msidbUpgradeAttributesVersionMinInclusive in Attributes to include VersionMin in the range. If VersionMin equals an empty string ("") it is evaluated the same as 0. If VersionMin is null, FindRelatedProducts ignores msidbUpgradeAttributesVersionMinInclusive and detects all previous versions. VersionMin and VersionMax must not both be null.
VersionMin must be a valid product version as described for the ProductVersion property. Note that Windows Installer uses only the first three fields of the product version. If you include a fourth field in your product version, the installer ignores the fourth field.
See more information in
Major Upgrades.